Results 1 to 5 of 5
  1. #1
    IanDJDavies is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    1

    DLookUp Function

    Hi All ... Please Help!



    I am creating a login form and after I update the Username I want a txt box to show the full name of the user .. I call it the Display name. The following I have put on the After Update ..

    txt_Display = Dlookup("[DisplayName]",tbl_Users,"[Username]=" &Forms! frm_SystemEntry![txt_UserName])

    Code is wrong I know as it shows blank. Little help as this is my first program for college.

    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Looking at the site Paul gave you a link to, you'll note that your syntax

    "[Username]=" & Forms! frm_SystemEntry![txt_UserName])

    is only correct if Username is defined as a Number, which seems unlikely. For a Field defined as Text, the syntax would be

    "[Username]='" & Forms! frm_SystemEntry![txt_UserName] & "'")

    Assuming that frm_SystemEntry is the Form this code appears in, you could simply use

    "[Username]='" & Me.txt_UserName & "'")

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    If you're going to give out fish, mention the table name needing to be in quotes too.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Good catch...missed that!
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. DLookup Function
    By Alex Motilal in forum Programming
    Replies: 8
    Last Post: 08-14-2014, 01:15 PM
  2. Dlookup Function
    By MarkHenderson in forum Queries
    Replies: 1
    Last Post: 11-19-2012, 03:00 PM
  3. DLOOKUP function
    By tariq1 in forum Programming
    Replies: 5
    Last Post: 07-17-2012, 04:22 PM
  4. DlookUp Function.
    By cap.zadi in forum Forms
    Replies: 11
    Last Post: 09-22-2011, 12:56 PM
  5. Need Help for Dlookup function
    By wasim_sono in forum Programming
    Replies: 5
    Last Post: 01-04-2006, 08:18 AM

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