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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Date Fields 1

Status
Not open for further replies.

madrappin

Technical User
Mar 16, 2004
68
US
I am trying to use vb code to specify a filter that a report is opened with. So strfilter is what I use in the docmd.openreport, however I can't figure out how the string is supposed to look. What I have is...

Code:
strfilter = strfilter & " tblData.[RR DATE] BETWEEN 10/31/'&Me.txtFiscalYear-1&' AND '&09/30/&Me.txtFiscalYear&'"

So basically it takes what the user has entered in a field called txtFiscalYear, and uses that to create a range of dates. However, its giving me errors, I think because of the way I have written it. Can any of you coding gods help me out with this? Thanks.
 
strfilter = "tblData.[RR DATE] BETWEEN #10/31/" & Me.txtFiscalYear-1 & "# AND #09/30/" & Me.txtFiscalYear & "#"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks a lot! You have helped me through pretty much all of my coding problems, and I can't thank you enough for helping out the beginners like myself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top