Solved

taking dates from form and placing into query not working

Posted on 2014-09-16
4
122 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 34

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 49

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

914 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now