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

Query Analyzer Help 1

Status
Not open for further replies.

hamking01

Programmer
May 30, 2004
238
US
I have a form with a year(1) and date(2) field. Users fill in both and click button. Onclick for button will run query for a records from Jan. 1 to the date(2) inputted by user for the year(1). How would I put this into the criteria of the query design.

Something like "Between 1/1/[form]![year] AND [form]![date]"

 
Between DateSerial([Forms]![main form]![year],1,1) And [Forms]![main form]![date]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanx for the quick response. Tried the following:

Between DateSerial([Forms]![SteveSpendReportForm]![Year],1,1) And [Forms]![SteveSpendForm]![EndDate]

But it returns: The expression is typed incorrectly, or it is too complex to be evaluated.

Any ideas.
 
Create a hidden textbox named StartDate with ControlSource set to:
=DateSerial(Me![Year],1,1)
Then the criteria:
Between [Forms]![SteveSpendReportForm]![StartDate] And [Forms]![SteveSpendForm]![EndDate]


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I've placed =DateSerial(Me![Year],1,1) in the controlsource of a textbox, but when i open the form the textbox has "#Name?". When entering a year into the [Year] textbox, the #Name? remains. How would I get it to load the year into the textbox. Thanx.
 
Got it, no need for the Me!, just =DateSerial([Year], 1, 1)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top