Solved

taking dates from form and placing into query not working

Posted on 2014-09-16
4
128 Views
Last Modified: 2014-09-17
I have a form that has 2 text boxes for "start date" and "EndDate".
using the BETWEEN operator in the field "QueryDate"...


SELECT dbo_iData_Desc_Search_Log.RACF, dbo_emp_directory_04172014.emp_name, dbo_emp_directory_04172014.mgr1_name, dbo_iData_Desc_Search_Log.QueryDate, dbo_iData_Desc_Search_Log.ProcRun, dbo_iData_Desc_Search_Log.SearchTerm, dbo_iData_Desc_Search_Log.iDataVersion
FROM dbo_iData_Desc_Search_Log INNER JOIN dbo_emp_directory_04172014 ON dbo_iData_Desc_Search_Log.RACF = dbo_emp_directory_04172014.emp_racfid
WHERE (((dbo_iData_Desc_Search_Log.RACF)=[Forms]![iData_Reporting]![Combo5]) AND ((dbo_emp_directory_04172014.mgr1_name)=[Forms]![iData_Reporting]![Combo3]) AND ((dbo_iData_Desc_Search_Log.QueryDate) Between [forms]![iData_Reporting]![Text37] And [forms]![iData_Reporting]![Text39]))
ORDER BY dbo_iData_Desc_Search_Log.QueryDate;

Need correct syntax


Thanks
fordraiders

Open in new window

0
Comment
Question by:fordraiders
  • 2
4 Comments
 
LVL 36

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40325659
Are you getting an error message?  What is it?
Are the textboxes defined as date data types?
Does QueryDate include time?

PS - before you write any code or reference any controls on a form, best practice is to give them meaningful names so Text37 should be something like txtFromDT and Text39 should be something like txtThroughDT.  Combo5 should be cboRACF and Combo3 should be cbomgr1_name
0
 
LVL 3

Author Comment

by:fordraiders
ID: 40325679
Between DateValue([forms]![iData_Reporting]![Text37]) And DateValue([forms]![iData_Reporting]![Text39])....this worked.

Thanks included  datetime...that helped.
0
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 40327437
DateValue is perfect here.

And Pat is right. Get rid of Text39 etc. at the very soonest as the first thing you do.

/gustav
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 40327990
Thanks for the direction
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question