Results 1 to 3 of 3
  1. #1
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286

    Help with Dlookup

    hello, i have a textbox on a form where someone will be adding new users to the tblUser. However, if the name already exists in the tblUser, then message will appear notifying the user. However, my code is only looking at the first value of the "user" column and not at the whole column. it will throw the error message only for those first name in that column, how do i get it so it look at the WHOLE row and not just the first row? thanks!




    my code:

    If Me.txtName = DLookup("Users", "tblusers", "Users") Then
    'Look up the _____ field, from the _____ table, where the record is _____


    MsgBox ("This Name Already Exists!")
    Me.txtName = ""
    End If




    ^"Users" is the name of my User Name column

  2. #2
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286
    nevermind, used

    Private Sub txtName_AfterUpdate()
    If Me.txtName = DLookup("Users", "tblusers", "Users = '" & txtName & "'") Then
    'Look up the _____ field, from the _____ table, where the record is _____


    MsgBox ("This Name Already Exists!")
    Me.txtName = ""
    End If

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks for sharing your solution.

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. Dlookup
    By jarvisaurus in forum Queries
    Replies: 4
    Last Post: 01-24-2012, 01:21 PM
  3. Help with a Dlookup
    By funkygoorilla in forum Programming
    Replies: 1
    Last Post: 01-21-2012, 10:04 AM
  4. dlookup
    By ali zaib in forum Access
    Replies: 3
    Last Post: 01-13-2012, 11:57 AM
  5. Dlookup??
    By Vikki in forum Access
    Replies: 4
    Last Post: 02-16-2010, 07:59 AM

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