-
The WHERE refers to the SELECT object; in this case you are inserting values, so there is no table or query to test those values against.
If the Employee ID field is an autonumber, you shouldn't have to include that in your query as it will be automatically populated. However if you need to test that the Employee ID doesn't already exist in the table, you should test for this first:
[vba]
If IsNull(DLookup("[Employee ID]", "Assign Hardware", "[Employee ID]=" & eid)) Then
Query = "INSERT INTO [Assign Hardware] " & _
"([Employee ID],[Base Unit ID],[Monitor ID],[Keyboard ID]," & _
"[Printer ID]) " & _
"VALUES (" & eid & ",'" & bid & "','" & Mid & "','" & kid & _
"','" & PID & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL Query
DoCmd.SetWarnings True
End If
[/vba]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules