I have added a text box on my EmpDate form to display the Employee Name. The field is called EmpName. I have a relationship set up between the EmpDate table and the Employees table connected by the EmpID field. The EmpName is stored in the Employees table.
When I do the data entry with the EmpDate form the name displays fine.
When I use the Search Button I do not get the results I want.
See Attachment for Screen Captures.
Here is my code:
Form_EmpDate.RecordSource = "Select * from EmpDate where [EmpDate].DateWorked = " & _
Format(Me!txtSearchDateWorked, "\#mm\/dd\/yyyy\#") & _
" And [EmpDate].EmpID = " & Me!txtSearchEmpID
I tried the following code:
Form_EmpDate.RecordSource = "Select * from EmpDate, Employees where [EmpDate].DateWorked = " & _
Format(Me!txtSearchDateWorked, "\#mm\/dd\/yyyy\#") & _
" And [EmpDate].EmpID = " & Me!txtSearchEmpID
And this code almost works (the Employee Name displays) but now the EmpID doesnt display correctly and the record count at the bottom gives an error.
I have attached the database and screen captures.
I know this must be fairly easy to do so if someone could take a look I would appreciate it.
When I do the data entry with the EmpDate form the name displays fine.
When I use the Search Button I do not get the results I want.
See Attachment for Screen Captures.
Here is my code:
Form_EmpDate.RecordSource = "Select * from EmpDate where [EmpDate].DateWorked = " & _
Format(Me!txtSearchDateWorked, "\#mm\/dd\/yyyy\#") & _
" And [EmpDate].EmpID = " & Me!txtSearchEmpID
I tried the following code:
Form_EmpDate.RecordSource = "Select * from EmpDate, Employees where [EmpDate].DateWorked = " & _
Format(Me!txtSearchDateWorked, "\#mm\/dd\/yyyy\#") & _
" And [EmpDate].EmpID = " & Me!txtSearchEmpID
And this code almost works (the Employee Name displays) but now the EmpID doesnt display correctly and the record count at the bottom gives an error.
I have attached the database and screen captures.
I know this must be fairly easy to do so if someone could take a look I would appreciate it.