locked
DLookup not working -- have spent hours trying to figure this out - HELP! RRS feed

  • Question

  • HI, can anyone see anything wrong with the below statement?

    =DLookUp([client_contact_email],"qry_client_contact_from_frm_dahsboard","clientid_lnk" & [Clientid])

    I want my control to be set to show the client contact email address from query - qry_client_contact_from_frm_dashboard.  The main key link is the ClientID

    Thanks in advance.

    Wednesday, September 3, 2014 11:27 PM

Answers

  • The double-quotes are wrong and probably a missing equality comparison operator in the 3rd argument.

    It should be something like:

    =DLookUp("[client_contact_email]","[qry_client_contact_from_frm_dahsboard]","[clientid_lnk]=" & [Clientid])

    Are you sure the Query name is correct? "dahsboard" looks like a mistype of "dashboard" to me?

    Also, the above only works if the Field [clientid_lnk] is of numeric data-type.  If it is of Text data-type, you need to enclose the supplied value (resolved from [ClientID]) with double-quotes.


    Van Dinh




    • Edited by Van Dinh Thursday, September 4, 2014 1:29 AM Correct double-quotes
    • Proposed as answer by ryguy72 Saturday, September 6, 2014 2:45 PM
    • Marked as answer by Luna Zhang - MSFT Wednesday, September 10, 2014 6:32 AM
    Thursday, September 4, 2014 12:02 AM

All replies

  • The double-quotes are wrong and probably a missing equality comparison operator in the 3rd argument.

    It should be something like:

    =DLookUp("[client_contact_email]","[qry_client_contact_from_frm_dahsboard]","[clientid_lnk]=" & [Clientid])

    Are you sure the Query name is correct? "dahsboard" looks like a mistype of "dashboard" to me?

    Also, the above only works if the Field [clientid_lnk] is of numeric data-type.  If it is of Text data-type, you need to enclose the supplied value (resolved from [ClientID]) with double-quotes.


    Van Dinh




    • Edited by Van Dinh Thursday, September 4, 2014 1:29 AM Correct double-quotes
    • Proposed as answer by ryguy72 Saturday, September 6, 2014 2:45 PM
    • Marked as answer by Luna Zhang - MSFT Wednesday, September 10, 2014 6:32 AM
    Thursday, September 4, 2014 12:02 AM
  • thanks Van, that works ok.  All I need to get working now is requerying the Combox box which drives all this.  What code should I use and where should I put it?  Thanks
    Thursday, September 4, 2014 6:33 AM
  • There is a Requery Method fo the ComboBox Control but I am not sure of the context of what you are trying to do.

    Check Access VBA Help to see if Requery Method is what you need.

     


    Van Dinh

    Thursday, September 4, 2014 10:55 AM