Mick Peters
Board Regular
- Joined
- May 18, 2015
- Messages
- 93
Sorry if this has been asked before but I cannot get the syntax right for this DLookup. I am at the start of this project converting something I have done in Excel to Access. I have checked several threads but just can't get it right. It does not error when I check the compile but errors when it fires (After Update).
I have a form called frm_input on that form all fields are unbound, Date,Time ,Employee and Location. I have a field called employee where I enter a name and a field named Location where I want to have the VBA (Dlookup) fill in the location of the employee from the table T_Employee.
The table called T_Employee has 5 fields. One is Employee and one is Location.
The VBA I have is
Me.Scan_Date.Value = Date
Me.Scan_Time.Value = Time
Me.Location.Value = DLookup("Location", "T_Employee", "Employee = " & Forms![frm_Input]![Employee])
End Sub
This fills in the Date and time but fails on the DLookup
Any help would be appreciated.
Thanks,
Mick.
I have a form called frm_input on that form all fields are unbound, Date,Time ,Employee and Location. I have a field called employee where I enter a name and a field named Location where I want to have the VBA (Dlookup) fill in the location of the employee from the table T_Employee.
The table called T_Employee has 5 fields. One is Employee and one is Location.
The VBA I have is
Me.Scan_Date.Value = Date
Me.Scan_Time.Value = Time
Me.Location.Value = DLookup("Location", "T_Employee", "Employee = " & Forms![frm_Input]![Employee])
End Sub
This fills in the Date and time but fails on the DLookup
Any help would be appreciated.
Thanks,
Mick.