Results 1 to 4 of 4
  1. #1
    thescottsman92 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2013
    Posts
    13

    Dlookup with criteria of textbox

    Hi All



    I have a form that I need to get the email address of into a textbox.

    So far I have a textbox that the user choose the full name of the person from a combo box

    I have another textbox that sould display the email address. I ca get it to display the email address of the first name in the table b8ut it does not change when I enter a different name. I have entered this code:

    Private Sub sendchoose_AfterUpdate()
    Dim stremail As String
    stremail = DLookup("EmailAddress", "Operators", "FullName")
    Me.ccsendto = stremail
    End Sub

    in the after update event on the combo textbox

    thanks for your help

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Correct your syntax for Dlookup
    See http://www.techonthenet.com/access/f...in/dlookup.php

  3. #3
    thescottsman92 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2013
    Posts
    13
    Thanks for the reply

    I have looked at that age before yes it helps in forming the structure but does not help me problem

    basically I want a statement that is like

    =dlookup("EmailAddress","Operators","Fullname=me.s endchoose") but as fair as I know (and I have little experience) you cant but the statement like that. Any other way to form this?

    Thanks

  4. #4
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Look at it again, particularly note the use of delimeters ' and #.
    If your fullname is a text field, then
    Code:
    dlookup("EmailAddress","Operators","[Fullname]='" & me.sendchoose & "'")
    Note the single quote ' in red color.

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

Similar Threads

  1. Replies: 4
    Last Post: 05-31-2013, 07:00 PM
  2. DLookup with textfield in criteria
    By smeghead67 in forum Programming
    Replies: 4
    Last Post: 08-07-2012, 12:18 PM
  3. Dlookup with multi Criteria
    By rkalapura in forum Forms
    Replies: 2
    Last Post: 06-15-2012, 06:18 PM
  4. dlookup with a contains criteria?
    By noretoc in forum Access
    Replies: 3
    Last Post: 05-02-2012, 10:18 AM
  5. Multiple criteria in DLookup
    By crowegreg in forum Forms
    Replies: 7
    Last Post: 06-22-2011, 01:47 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