Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Sep 2002
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple Dlookup (2002-Sp2)

    Well this should be easy, but i cannot get it to work. I've done a huge search and can't find anything for what i need. although it should be a common problem. (and i have nothing in Access help for some reason)

    Table called 'TLS, with fields:-
    eNumber ---- Name ---- Password

    65 Bob Cat
    5675 Tim Purple

    A function runs in the On Load event of the form load. this returns NetworkUserName. (Text Field)
    I want the variable Myname, to be equal to 'Bob', when the NetworkUserName = 65

    so far, i've tried (amongst others)

    MyName = DLookup("Name", "TLS", "[NetworkUserName]=[eNumber]")
    MyName = DLookup("Name", "TLS", "[NetworkUserName]=" & Chr(34) & "65" & Chr(34))
    MyName = DLookup("Name", "TLS", "[NetworkUserName]=" & Chr(34) & "[eNumber]" & Chr(34))

    Presume the Criteria is Fubar.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Simple Dlookup (2002-Sp2)

    The criteria string should be of the form "FieldName = value" ((in this situation). The field in the table you want to filter on is eNumber, and the value is that of NetworkUserName. So try

    MyName = DLookup("Name", "TLS", "eNumber = " & NetworkUserName)

    if eNumber is a number field, or

    MyName = DLookup("Name", "TLS", "eNumber = " & Chr(34) & NetworkUserName & Chr(34))

    if eNumber is a text field.

  3. #3
    3 Star Lounger
    Join Date
    Sep 2002
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Simple Dlookup (2002-Sp2)

    Cheers Hans.

    Added another virtual beer for you ! <img src=/S/bow.gif border=0 alt=bow width=15 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •