Filter a Query between Two Dates

kheekhay15

New member
Local time
Today, 11:08
Joined
Sep 21, 2012
Messages
5
Hi,

I have a form with a subform based on a query. There are many fields in that query. On the form, there are certain criterias which when typed onto the box or selected from a combo box will update the query which in turn will update the subform. By the way, there is a "SEARCH" button that when pressed runs the command Me.[subformname].Requery.

My only problem now is the date. I have a field in my table named DateRecalled. I have two text boxes in my main form for the start date and end date. What code or criteria in my query do I need to put so that when I requery, it will filter all dates from the two text boxes for the dates.

In my query named qrybuilder, I put this as a criteria on the fields: Like "*" & [Forms]![frmQueryBuilder]![cboSex] & "*"

The [cboSex] changes depending on the field.

xxx.facebook.com/photo.php?fbid=4954018855274&set=a.1260047668303.4 0780.1443003309&type=1&relevant_count=1&ref=nf

Any ideas?
 
When dealing with dates you need to use the octothorpe (#) before and after a date, EG in the criteria of the date field you want to search on use

"Between #" & firstdate & "# AND #" & seconddate & "#" where firstdate and seconddate are actual dates or the source from a control on a form
 
Last edited:
Hi

I think my question is the same as above, but I am looking for help.
I have a form for when a person is on duty- so it has name, dateon and dateoff.

Each day at 23:59 a daily report is produced which amongst other things that have happened during the past 24 hours, shows the person on duty for the selected day. This report is generated by entering a date on a form, the date been that required for that day's specific report.

It is ok if the date is the same as the dateon, but my problem is that I cant get the report to show a chosen report date that is not the dayon.

I have tried a variety of criteria in my query, but am still at a loss to finding the solution. I know I want something that is between (and including) dateon/dateoff

Many thanks
 

Users who are viewing this thread

Back
Top Bottom