Search code examples
vbams-access

Access DlookUp not working with multiple Criteria


The Dlookup Function is Giving me a syntax error I have tried multiple ways but none worked

x = DLookup("Clock_ID", "User_access", "Clock = " '" & Me.Clock_ID & _
         & " AND Module = '" & Me.m_1 & "'")

I basically Need it to check 2 fields in the same table at the same time so the ID can be duplicated But the Module cant be duplicated.


Solution

  • I guess ID is numeric, so try:

    x = DLookup("Clock_ID", "User_access", "Clock = " & Me.Clock_ID & " AND Module = '" & Me.m_1 & "'")