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

Quick VBA and SQL conversion

Status
Not open for further replies.

NotOnUrNelly

Technical User
Mar 28, 2003
3
GB
Hi

Could you please help me with the following, I have two text boxes on a form that will be used for two dates, I have a field on a report that is called outcome1.

I need the Variable strWhere to hold the sql code that allows outcome to be filtered between the two dates on the form

I have put the following code together (adapted from a book) but it does not seem to work

can you help

strWhere = "[outcomeDate1]" = "between" & " #" & txtFrom & "#" And " #" & txtValueTo & "#"

Thanks in advance
Jamie
 
Hi!

Try:
[tt]strWhere = "[outcomeDate1] between #" & txtFrom & "# And #" & txtValueTo & "#"[/tt]

A hint here, try to enter a line Debug.Print strWhere after assigning it, and it would dump the line to the immidiate pane (CTRL+G). There it might be browsed. Such assigning should assig a valid Where clause as viewed in the QBE sql view.

If there are errors, please also state errormsg. That hepls when trying to assist.

- note - if you'r regional settings differs from US date format, formatting the dates might also be an issue, then try:

[tt]...format$(txtFrom, "yyyy-mm-dd")[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top