Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combining LIKE, BETWEEN and FORMS

Status
Not open for further replies.

Stevehewitt

IS-IT--Management
Jun 7, 2001
2,075
GB
Guys,

I have the following string in as the criteria for the 'Date' field of my query:

Code:
[Forms]![frmReportDateSpecific]![txtStartDate] And [Forms]![frmReportDateSpecific]![txtEndDate]

This has worked fine as the field in the table was stored as a short date.
However, we are changing data sources to a third pary product where the data is a date/time format. E.G:

28/06/2005 22:44:00

The problem is that I don't really care about the time - I just need to search by the date. How would I go about changing the query criteria above to search only the date part, but still have the FORMS and BETWEEN parts? (I'd imagine incoporating a LIKE part in there somewhere)

Cheers,



Steve.

"They have the internet on computers now!" - Homer Simpson
 
no, in the field you are comparing, you just check the date part:

DatePart(FieldName) BETWEEN [Forms]![frmReportDateSpecific]![txtStartDate] And [Forms]![frmReportDateSpecific]![txtEndDate]

(at least I think it's DatePart - search the help for it!!)

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
You may try this:
BETWEEN Int([Forms]![frmReportDateSpecific]![txtStartDate]) And Int([Forms]![frmReportDateSpecific]![txtEndDate])


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for your help guys.

LesPaul - Thanks for your quick reply; but I'm not sure that I follow. What do you mean by (FieldName) - what field? I'm not comparing anything as such.

PHV Thanks for your help (again! :)). I can't get the expression to work. It comes up saying that the expression is too complex.

I don't think that it makes any difference, but the table is a linked table to Exchange Server 2005. (I need to count how many email as in a particular folder at any one time!)

Cheers guys,




Steve.

"They have the internet on computers now!" - Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top