Modules & VBA :: Filter Diary Data Using Two Dates?
Jun 7, 2013
I have a sub form dragged into a main form that shows all existing diary entries. I have already got code for various different filters but I am struggling to wrap my head around this one. Just want the user to input two dates and then the sub form to show all the diary entries between those 2 dates. Or maybe a drop down box listing various lengths of time from today's date and showing entries within that time scale. Whatever is easiest tbh. Would I have to use date diff for this?
View Replies
ADVERTISEMENT
Sep 12, 2013
I have created a piece of code that filters a sub form of diary records using criteria the user has selected or entered. It was working fine when I made it a month or so ago and now is seems to be returning incorrectly filtered records, for example, I enter 2 dates to return all diary entries between the 2 dates. Yet it misses some records out that should be within the date range, and it sometimes include records that are outside the date range. I am also getting an error when I try and filter the diary entries via the supplier, "data type mismatch", here's the code that, bearing in mind, was previously working fine.
Code:
Public Function filter_diary()
Dim dbs As Database
'Dim qdf As QueryDef
Dim Sqlstr As String
Dim sqlstrwhat As String
[code]....
View 1 Replies
View Related
Oct 23, 2014
I am trying to filter a report based on two user inputted dates, but can't seem to figure it out. I've played around with quotation marks, and # but can't seem to figure the syntax out.
Code:
Me.OrderBy = "Date Submitted"
Me.OrderByOn = True
Dim Date1 As Date
Dim Date2 As Date
Date1 = UserInput
Date2 = UserInput
DoCmd.ApplyFilter WhereCondition:="[Date Submitted] > Date1 and < Date2"
View 11 Replies
View Related
Jul 24, 2014
Running Access 2010 and developed this query to filter out data from a table between times on 2 dates (day before report run and day of report). Covers data from a shift that carries over to the next day.Trouble is, the PC i developed on still operates the query as expected. However, on the PC the database resides (not networked just stored) and operates, the query brings up no data at all unless I remove the Time filtering.
This PC used to operate correctly up until early this year (about 18 months operated correctly) when the PC was replaced due to failure. Access version is the same and I am at wits end to what the cause is. Here is what my query looks like:
Quote:
SELECT Breakdowns.BreakdownDate, Breakdowns.Time, Breakdowns.Shift, Breakdowns.Downtime, Breakdowns.Equipment, Breakdowns.Conveyor, Breakdowns.Fault, Breakdowns.Stopper, Breakdowns.Gate, Breakdowns.Dolly, Breakdowns.Carrier, Breakdowns.FaultType, Breakdowns.Comments, Breakdowns.Tradesman
FROM Breakdowns
WHERE (((Breakdowns.BreakdownDate)=Date()) AND ((Breakdowns.Time) Between #00:00:00# And #6:29:00#) AND ((Breakdowns.Shift)="Night")) OR (((Breakdowns.BreakdownDate)=Date()-1) AND ((Breakdowns.Time) Between #22:30:00# And #23:59:00#) AND ((Breakdowns.Shift)="Night"));
View 14 Replies
View Related
Dec 11, 2013
I want to append data to the FC_TEMP table with the condition that the time_period is same on FC_TEMP and Scrap_Sales_Forecast table.Somehow it asks me to type in a parameter for Time_Period on FC_TEMP.
Code:
'Append Scrap Sales forecast to actual FC_TEMP table
Public Sub Append_Scrap()
DoCmd.RunSQL "INSERT INTO [FC_TEMP] SELECT Scrap_Sales_Forecast.* FROM Scrap_Sales_Forecast " & _
" WHERE FC_TEMP.[Time_Period] = Scrap_Sales_Forecast.[Time_Period]"
End Sub
View 3 Replies
View Related
Oct 24, 2013
I am trying to write code for a form. When the user enters the "Number of Payments" and the "1st payment date" it will fill the amount of the payment into a specific month.
For example: 1st payment date would be 10/24 the payments would be bi-weekly and the amount would be $50.00. The number of payments would be 4. I would need it to put $50.00 into a field called "October" $100.00 into a field called "November" and $50.00 into a field called "December". In excel I would do this simply by using a (date)+14 formula. I am sure that I need to do this with loops but where to even begin.
View 1 Replies
View Related
Jan 10, 2015
I am trying to filter a recordset with a variable q. The field in the table associated with the record set is of data type Date/time. I assigned data types String and Date to q but both cases generates the error message " Data type mismatched in expression".
View 10 Replies
View Related
Sep 11, 2013
Custom filter I'm trying to set up. I have a data full of records with multiple columns and a form linked up to it. The form has a search box that works as well as navigation buttons.
Currently I am trying to get a filter to work. The filter will use up to five combo foxes to narrow down the fields, then return the filtered records after clicking a button. The button itself is where my code is. My issue now though is I cannot get the filter to work if I try to use more than one combo box.
The code I have at the moment is as follows:
'------------------------------------------------------------
' cmdApplyFilter_Click
'
'------------------------------------------------------------
Private Sub cmdApplyFilter_Click()
Me.Filter = "[Asset Group] = " & Me.cmbFilter1 & "" And "[Location] = " & Me.cmbFilter4 & ""
Me.FilterOn = True
End SubThe current error I am getting is Error 13: Type mismatch. I also know that the And might be the cause but I cannot change it to AND: it keeps changing back.
View 9 Replies
View Related
Nov 1, 2006
Not sure if this is the right place
But do any of the calendar's available open a day to a time slot type expanded daily record.
i've seen one that lets you put notes on a whole day.
Hope you get what I mean
View 4 Replies
View Related
Nov 8, 2007
Hi,
Within the past 3 weeks I spotted a post that was based around a diary type form, It is distinctive in the way that the guy had created an image using Photoshop or something similar and used it as a backdrop to the form.
It looked pretty neat.
Problem is I cant find it again and I think its just the type of thing I am currently looking for.
Does anyone recall it?
Garry
View 1 Replies
View Related
Mar 22, 2005
i am looking for an outlook style planner in Ms Access for a booking sytem i am trying to put together, can anyone point me in the right direction of how best to tackle this please.
I have scoured the net for samples, and have come back to the most helpful place on the net for more assistance on where to go with this...
What i am looking to do is to set up something like this..
Click here to see example picture
how hard would this be to do?
Cheers
Andy
View 3 Replies
View Related
Oct 4, 2007
Hi all, thought i had finished this one but apparantly not yet :)
Firstly can anyone see a problem with this statement?
SELECT Final.* INTO NewTable FROM Final WHERE LoginDate <> #02/07/2007#
It works fine with non date/time values..
It's probably something silly i know but any help is appreciated...
Thanks
Mike
View 10 Replies
View Related
Jul 26, 2012
I'm running the following servers:
1. A Windows Server 2008 with MSEXCHANGE
2. A Windows Server 2008 with Terminal Server - my MSAccess database FE & BE is installed on this server.
3. Both servers are on the same LAN network.
4. The APPOINTMENT BOOK is in the MSAccess database and i have add the the idividual MAILBOXES in my tblEmployees.
5. I want the employees to make their appointments in the APPOINTMENT BOOK (4 above) and then the appointment must also be inserted/displayed in the employees MSOutlook calendar.
6. This works fine when the employees MSOutlook is open on the Terminal Server (2 above).
this will in effect mean that we need to open all users (emplyees) MSOutlook on the Terminal Server to insert the appointments from the MSAccess database into the MSOutlook calendar.I should think that there must be a way to insert the appointments from the MSAccess database into MSOutlook without opening all the the users MSOutlook on Terminal Server?
View 3 Replies
View Related
Feb 10, 2014
I'm trying to hash two scripts I've found into 1 functioning filter, however I'm still relatively new to vba and can't figure out how to get this working.
I'm trying to use Allen Browne's Search Criteria:
with another snippete of code I found here:
Code:
'Purpose: This module illustrates how to create a search form, _
where the user can enter as many or few criteria as they wish, _
and results are shown one per line.
[Code]....
It's the date part I'm having trouble with, the rest of the search criteria work fine without the date, but I can't get it working when I try to modify and merge the date sections of each code.
Also I'm using a listbox for the "Yesterday";"Last 4 days";"Last 9 days" and not a combo box.
View 2 Replies
View Related
Aug 20, 2007
I have a query which is filtering by date as criteria...but it won't filter right.There is a date field from a table in another query which has date/times in it.I have used Format([Field], "Short Date") in that query to display just the date.I am now doing another query which points to that query (It's a SQL Union query if that matters) and it has the following for the Criteria:Between "6/1/2007" And "6/30/2007"However, it is showing anything in the month of June for the years 2005, 2006 and 2007, instead of just 2007. Any ideas why it is doing this? It doesn't make sense to me that it will filter for the month/date but not the year.I also tried changing the format to Format([Field], "mm/dd/yyyy") and criteria of "06/01/2007", etc.
View 11 Replies
View Related
Mar 21, 2015
I am probably quite wrong but I am trying to apply a filter that returns all dates within the current month
The bulk of the filter is from Microsoft Access examples.
Private Sub MonthB_Click()
DoCmd.ApplyFilter , "DueDate Year([DueDate]) = Year(Now()) And Month([DueDate]) = Month(Now())"
End Sub
It is not working??
View 3 Replies
View Related
Feb 19, 2015
I have a few queries which are used to create reminder email on training which is due for renewal.Some training required reminder 6 months before 2 year expiry. I use this in the criteria for the training date within query:
Between DateSerial(Year(Date()),Month(Date())-18,1) And DateSerial(Year(Date()),Month(Date())-17,0)
Some training required reminder 3 months before 1 year expiry. I use this in the criteria for the training date within query:
Between DateSerial(Year(Date()),Month(Date())-9,1) And DateSerial(Year(Date()),Month(Date())-8,0)
My problem is with training requiring reminder 6 months before 3 year expiry. Using this criteria:
Between DateSerial(Year(Date()),Month(Date())-30,1) And DateSerial(Year(Date()),Month(Date())-29,0)
Doesn't show any results (although there is training which was done 30months ago, expiring in 6 months time).
Changing the -30 (months) and -29 (months) in above down to -22 & -21 shows records as expected, but anything below -22/-21 doesn't show any records.
View 3 Replies
View Related
Jan 23, 2014
I'm trying to filter an append query by a year selected in a combo box [cboYear] for a field [ProgramDate]. The AfterUpdate on the cbo filters the append query based off of the selection (or selections-I'm using multiple combo boxes on the form). I then run a report based off of the appended table for a report.
I set my criteria for [ProgramDate] the query to be:
Code:
Year([ProgramDate])=[Forms]![frm_rpt_Programs]![cboYear]
The above code isn't working, even when I just try to run the query while the form is open. It's still returning all records.
View 2 Replies
View Related
May 28, 2013
Currently I have a main form w/ subform. In the main form, a user selects a bond's serial number from a combo box and the subform displays the bond's returns for the months owned along with a start date (each month has its own start date). So if I enter bond ABC in combo box, the subform will display "13-01-01, 4%" for January, "13-02-01, 8%% for February..etc.
So if we owned a bond from January to March, it will display the three months' returns. I want to add two combo boxes: begin and end date so that I can filter the subform to only show a particular set of months' returns.
I have three tables right now: Cusips, which lists each bond's serial number, CusipStartPK, which lists the monthly returns for each serial number, and ParameterDates, which is a list of four start dates--ie 13-01-01 for January, 13-02-01 for Feb, etc.
I've tried parameter queries and vba codes from other threads but I can't get this to work.
View 4 Replies
View Related
Nov 15, 2011
I have a master table which shows all transactions per record (person) over a financial year.
Each record person has a seperate package period over which their spend needs to be measured. Therefore although I have all their transactions for the year, I only want to sum their transactions between their given [start date] and [end date] which are in columns.
I need to be able to create a field which sums all expenditure per record between the start and end dates
Name Start Date End Date Invoice Date Amount
Matt 15/5/11 15/9/11 1/11/11 £100
Matt 15/5/11 15/9/11 7/7/11 £200
Matt 15/5/11 15/9/11 12/12/11 £200
In this case I would only want to sum 7/7/11 as this is between the start and end dates
I want to write something like sumif([Invoice Date] is between [start date] and [end date] - not sure where or how exactly
(The start date and end date will always be the same per person)
Is this possible in access?
View 10 Replies
View Related
Oct 24, 2013
I want to filter my subform data, to only show records where field A is a higher value than field B.
Code:
Me.MySubform.Form.Filter = "A > B"
Me.MySubform.Form.FilterOn = True
This way it doesn't find field B.
Code:
Me.MySubform.Form.Filter = "A > " & MySubform.Form!B
Me.MySubform.Form.FilterOn = True
This way it seems to filter all record to the field B value of the first record.
View 5 Replies
View Related
Jun 9, 2014
I have a retort that I want to use an option button to filter the report is a specific date is 48 hours before the current time. I'm not having any luck. Below is the code I have been playing with, but no go.
Private Sub NoMove_Click()
Select Case Me.NoMove.VALUE
Case 1
Me.Filter = "CLM = 'Now() - 48'"
Me.FilterOn = True
End Select
If Me.Filter = "" Then
MsgBox "The filter returned Null"
Else
End If
End Sub
View 14 Replies
View Related
Apr 17, 2014
how to return all values in a query when a form critieria is left blank. I have made some progress, the combo box criteria queries were fairly simple, but i'm getting stuck with my date criteria. My query doesn't return null values when I want it to.
I want it to return all records (including null values) if the form OpenFrom and OpenTo dates are blank, and just the values between the selected dates (excluding null values) if the form is completed.
Code:
SELECT qryReportSelector2_Authority.*, qryReportSelector2_Authority.ApplicationDate AS ApplicationDateFilter
FROM qryReportSelector2_Authority
WHERE (((qryReportSelector2_Authority.ApplicationDate) Between Nz([Forms]![frmReportSelector]![OpenFromDate],DMin("[ApplicationDate]","[qryAllCases]")) And Nz([Forms]![frmReportSelector]![OpenToDate],DMax("[ApplicationDate]","[qryAllCases]"))));
View 8 Replies
View Related
Aug 18, 2014
I'm not sure if I am biting off more than I can chew. I have a text field in each record in my database (Inherited) The db has nearly 5,000 records. I would like to split the field into records in a seperate table. An Example of the table as is now;
Code:
MemberIDBoats
5882Opossum(78-80) (87-89) Otter(80-84) Opportune(91-93) Turbulent(97-00).
5883Astute Auriga Aeneas Affray Amphion
2407H34 O10 Porpoise Trenchant Tapir.
I want to create a table as follows;
Code:
MemberIDBoatFromTo
5882Oppossum19781980
5882Oppossum19871989
5882Otter 19801984
5882Opportune19911993
5882Turbulent19972000
5883Astute
5883Auriga
5883Aeneas
5883Affray
5883Amphion
Etc.
Is this possible in one hit or do I need to process the records without dates first and then run another process to split those with Dates? I say dates but the field is a text field. About 15-20% of the records contain dates which are always enclosed in parenthesis.
View 14 Replies
View Related
Dec 30, 2014
I would like to filter data from a table using a query (from an data input form). The objective is to output all results if input form field is empty and to output results higher or equal to the type in the field if field is not Null. The query code is as follows:
IIf(IsNull([Forms]![Form2]![MaxDiffInput]);[Maximum operational pressure (bar)];[Maximum operational pressure (bar)]>=[Forms]![Form2]![MaxDiffInput])
However, is not providing any result when the input field (MaxDiffInput) as a value.
View 5 Replies
View Related
Jul 11, 2006
All,
Is it possible to filter parent records by child records (or subdata) without showing multiple instances of the parent data in the form/query?
Cheers,
Bobadopolis
View 2 Replies
View Related