Results 1 to 4 of 4
  1. #1
    jgelpi16 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544

    Question DLookup error

    I keep getting the following error when trying to use DLookup(). I have used DLookup several times before, can't really grasp why it is throwing this error...

    "Run-time error '2428':
    You entered an invalid argument in a domain aggregate function."

    Code:
        Dim varTPSel
        Dim varTPName
        Dim varTPAddr1
        Dim varTPCity
        Dim varTPState
        Dim varTPZip
     
        varTPSel = cboSelTP.Value
     
        varTPName = DLookup("[Tp]", CollCase, "[EntityId] = '" & varTPSel & "'")
        varTPAddr1 = DLookup("[Address]", CollCase, "[EntityId] = '" & varTPSel & "'")
        varTPCity = DLookup("[City]", CollCase, "[EntityId] = '" & varTPSel & "'")
        varTPState = DLookup("[State]", CollCase, "[EntityId] = '" & varTPSel & "'")
        varTPZip = DLookup("[Zip]", CollCase, "[EntityId] = '" & varTPSel & "'")
     
        txtTPName.Value = varTPName
        txtTPAddr1.Value = varTPAddr1
        txtTPCity.Value = varTPCity
        txtTPState.Value = varTPState
        txtTPZip.Value = varTPZip


  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    If CollCase is the name of the table, it needs to be in quotes. It would be okay like that if it was a string variable containing the table name.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jgelpi16 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544
    Perfect, thank you. I must have looked at this a dozen times!!

  4. #4
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    Please mark it as solved

Please reply to this thread with any new information or opinions.

Similar Threads

  1. DLookup example
    By pkstormy in forum Code Repository
    Replies: 1
    Last Post: 07-16-2012, 09:52 AM
  2. Need help with dlookup.
    By Keith in forum Database Design
    Replies: 8
    Last Post: 05-24-2010, 06:28 PM
  3. Dlookup in form returns #error
    By RickM in forum Access
    Replies: 1
    Last Post: 03-29-2010, 07:59 PM
  4. Dlookup??
    By Vikki in forum Access
    Replies: 4
    Last Post: 02-16-2010, 07:59 AM
  5. Replies: 2
    Last Post: 11-02-2009, 10:14 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums