[I'm new here]
Access 03
I'm currently having an issue using Dlookup when trying to reference a query (criteria syntax)
Currently I have 1 table, which is L_Emps (which contains Employee_ID as my key (numeric), First_Name, and Last_Name (as text).
My query is Query1 which is the following:
I have one form that is named L_EmpsForm. It is basically three bound fields that references Query1.
What I'm trying to do is have an onclick button return the ID that was returned from the query.
This is just a test database to try to teach myself how to use DLookup, but it isn't going so well. I can get DLookup to work fine if I use a static query, but whenever I prompt for the input, I usually get the "You canceled the previous operation" error. I've read up that some of the field references could be off, but I'm unsure as to what exactly.
I know it is a tad redudant to have the Onclick button return the value that is obviously right in front of me when I run the form, but I actually plan on passing the table information into different directions once I actually figure out Dlookup.
Advice?
-DH22
Access 03
I'm currently having an issue using Dlookup when trying to reference a query (criteria syntax)
Currently I have 1 table, which is L_Emps (which contains Employee_ID as my key (numeric), First_Name, and Last_Name (as text).
My query is Query1 which is the following:
Code:
SELECT L_Emps.Employee_ID, L_Emps.First_Name, L_Emps.Last_Name FROM L_Emps WHERE (((L_Emps.Employee_ID)=[ID:]));
What I'm trying to do is have an onclick button return the ID that was returned from the query.
Code:
Private Sub Command6_Click() ID = DLookup("[Employee_ID]", "[Query1]", "[Employee_ID]=" & [Forms]![L_EmpsForm]![Employee_ID]) MsgBox ID End Sub
I know it is a tad redudant to have the Onclick button return the value that is obviously right in front of me when I run the form, but I actually plan on passing the table information into different directions once I actually figure out Dlookup.
Advice?
-DH22
Comment