aalexander
New member
- Local time
- Today, 08:19
- Joined
- Mar 21, 2017
- Messages
- 6
Hello,
I am fairly new to Access. I got the basics down, but I am not too familiar with SQL and VBA.
I am trying to build a query that returns back records based on a Date field. I made a "Search Form" for people to input information such as:
(all of the following are unbound)
Employee (combo box)
Team (combo box)
Date (text box short date)
Week of (text box short date)
I got the Employee and Team criteria to work, but the next part is tricky. I want the query to search [Date] if it is not blank, and [Week of] if it is. I want the [Date] to return just that day for the employee or team. For week of, I want to return the date input into Week of and the 6 days following that.
I tried this criteria: (DateKey is the name of the field on the table i am trying to query)
IIf([Forms]![SearchForm]![Date] Is Not Null,[DateKey]=[Forms]![SearchForm]![Date],[DateKey] Between [Forms]![SearchForm]![Week] And ([Forms]![ShiftSearchForm]![Week]+6))
It came up with 0 results when i entered a date into the Date text box.
Any help would be greatly appreciated!
I am fairly new to Access. I got the basics down, but I am not too familiar with SQL and VBA.
I am trying to build a query that returns back records based on a Date field. I made a "Search Form" for people to input information such as:
(all of the following are unbound)
Employee (combo box)
Team (combo box)
Date (text box short date)
Week of (text box short date)
I got the Employee and Team criteria to work, but the next part is tricky. I want the query to search [Date] if it is not blank, and [Week of] if it is. I want the [Date] to return just that day for the employee or team. For week of, I want to return the date input into Week of and the 6 days following that.
I tried this criteria: (DateKey is the name of the field on the table i am trying to query)
IIf([Forms]![SearchForm]![Date] Is Not Null,[DateKey]=[Forms]![SearchForm]![Date],[DateKey] Between [Forms]![SearchForm]![Week] And ([Forms]![ShiftSearchForm]![Week]+6))
It came up with 0 results when i entered a date into the Date text box.
Any help would be greatly appreciated!