Solved Query based on combo box

HealthyB1

Registered User.
Local time
Tomorrow, 05:39
Joined
Jul 21, 2013
Messages
103
I am having a mental blank
I am trying to pull payroll records in a query based on a popup form that asks the user to enter StartDate, EndDate and EmployeeName
The employee field on the form
is based on a combo box tied to the employee file which brings back fields EmpID and Employee Name
As coded it works perfectly so I can records for employee from 1 to N and get their records for the date period specified.
However if the user doesn't select an employee name i would like to bring back all records for all employees for the time period specified.
I assume it is based on the employeename field or EmpId being null but I seem to have problem coding this in my query. Does anyone have a suggestion or a pointer to a query where this has been done?


Query problem.PNG
 
you can add 1 criteria for EmployeeID and JobDay:

for EmployeeID:
Nz([Forms]![Allcrete-Report-Date-Range]![Employee],[EmployeeID])


for JobDay:
Between Nz([Forms]![Allcrete-Report-Date-Range]![Beginning-Date],#01/01/1890#) And Nz([Forms]![Allcrete-Report-Date-Range]![Ending-Date],#31/12/9999#)
 
Thanks for replying ARNLGP
This what I received back after installing the code. The date picking works well standalone but the employee selection is not working
1616304796331.png
 
Thanks for replying ARNLGP
This what I received back after installing the code. The date picking works well standalone but the employee selection is not working
View attachment 90131
Hi arnlgp,

Many thanks I simply prefixed the field name with the table name and the problem was solved. Thanks ever so much.
 
Perhaps EmployeeID criteria should be:
[Forms]![Allcrete-Report-Date-Range]![Employee],[EmployeeID] OR IS NULL
 
Hi Bob,
Thanks for your input.
I used the following which directly referenced the correct table:-

Nz([Forms]![Allcrete-Report-Date-Range]![Employee],[WorkOrder Labor]![EmployeeID])
 

Users who are viewing this thread

Back
Top Bottom