Results 1 to 12 of 12
  1. #1
    emailloni is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    9

    PLEASE HELP! Dlookup event not working....

    Hello All,


    I'm pretty new to Access and am working on a very simple dlookup. Taking the KAM (persons name) from one table based on a common Customer Name/Sold To into a form that I am creating. Please take a peak at my code below and help me with my error:

    Private Sub SoldTo_AfterUpdate()
    KAM = DLookup("KAM", "CustomerKam", "CustomerName= 'SoldTo'")
    End Sub

    I don't get an error AT ALL with this code but it doen't work. If I make the below changes after reading some other threads I get the standard error of 3464ata Type Mismatch

    Private Sub SoldTo_AfterUpdate()
    KAM = DLookup("KAM", "CustomerKam", "CustomerName=" & SoldTo)
    End Sub


    I cannot find any documentation on the special characters required for numerics vs text....can anyone provide?

    Thank you SO much for your help!

    Loni

  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,521
    This help?

    DLookup Usage Samples

    This may be easier if appropriate:

    BaldyWeb - Autofill
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,543
    Try:
    KAM = DLookup("KAM", "CustomerKam", "CustomerName='" & SoldTo & "'")
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  4. #4
    emailloni is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    9

    Still not working.... :(

    Quote Originally Posted by Bob Fitz View Post
    Try:
    KAM = DLookup("KAM", "CustomerKam", "CustomerName='" & SoldTo & "'")
    Dear Bob,
    I tried and it's still not working, I'm not getting an error but it's not populating the lookup.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Have you set a breakpoint to test? To make sure that KAM isn't being assumed to be a variable (I assume it's on the form), try

    Me.KAM = DLookup("KAM", "CustomerKam", "CustomerName='" & Me.SoldTo & "'")

    I take it you didn't like my combo method?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    emailloni is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    9

    Still nothing

    Quote Originally Posted by pbaldy View Post
    Have you set a breakpoint to test? To make sure that KAM isn't being assumed to be a variable (I assume it's on the form), try

    Me.KAM = DLookup("KAM", "CustomerKam", "CustomerName='" & Me.SoldTo & "'")

    I take it you didn't like my combo method?
    That code didn't work either and I honestly don't know what you mean by "breakpoint to test". I just ordered $200 worth of training materials from Amazon and will get them in two days plus I signed up for level 1, 2, and 3 trainings with Illinois Computer Training. It just can't get here fast enough! Hopefully once I am properly taught everything will come together for me.

    Thank you for trying to help me!

    Loni

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    emailloni is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    9

    Thank you

    Quote Originally Posted by pbaldy View Post
    Can you post the db here?
    I've just finished my three days of access classes and everything makes SO much more sense now. Thank you for your help, I'm posting another question today about linking a command button to a series of different folders on a shared network. My instructor couldn't help me..... :/ I have the links set up in a table as field Link

    Loni

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help. This issue is resolved?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    emailloni is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    9
    Yup, this issues is all good now (my relationships were not set up right). Anyway you can check out my post on the command button that I need to link to a shared network folder?

  11. #11
    BBonexx is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    4
    Hey Loni,

    I am running into another issue quite similar. Could you please let me know what you did to solve your problem? Thank you,

    Julio L. Toko

  12. #12
    emailloni is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    9
    Quote Originally Posted by BBonexx View Post
    Hey Loni,

    I am running into another issue quite similar. Could you please let me know what you did to solve your problem? Thank you,

    Julio L. Toko
    Hello Julio,
    Actually I found out that if you set up your relationships correctly, there is absolutely no need for any sort of dlookup. Becuase any table of information that is related to another can pull from eachother. It's quite difficult to explain but you don't need a dlookup at all. I actually took three classes on Access after this post from CTS and that is where I learned everything.
    Good luck!
    Loni

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

Similar Threads

  1. NotInlist Event not working properly
    By thanosgr in forum Programming
    Replies: 2
    Last Post: 06-14-2012, 01:46 PM
  2. On Open form event not working
    By SPE_NY in forum Forms
    Replies: 2
    Last Post: 10-05-2011, 11:53 AM
  3. DLookup code not working
    By lukekelly in forum Programming
    Replies: 9
    Last Post: 06-15-2010, 06:08 AM
  4. combobox.dropdown event not working after error
    By perlyman in forum Programming
    Replies: 1
    Last Post: 04-02-2010, 06:55 PM
  5. Not In List event not working
    By Bruce in forum Forms
    Replies: 1
    Last Post: 03-12-2010, 02:24 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