Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2004
    Tunbridge Wells, Kent. UK

    Cool Unanswered: assign a value to a variable

    Hi all,

    I could really use some help here!

    I have a query that returns, amongst other things, an email address.

    I want to capture this emailaddress value and assign it to a variable.

    Then I want to run DoCmd.Output report and place the variable in the "To:" field.

    I can't work out how to run a query (preferably in the background) and assign the emailaddress value to my variable?

    Can you help please??!!!

  2. #2
    Join Date
    Nov 2003
    Dim EmailAddress As String
    EmailAddress = Nz(DLookUp("[tableCustomerEMailAddress]", "CustomerTableName", "[CustomerNameInTable] = '" & Me.CustomerNameOnForm & "'"), "")
    If EmailAddress = "" Then
       Msgbox "The Customer, " & Me.CustomerNameOnForm & ", has no E-Mail Address.", vbExclamation, "No E-Mail Address"

Posting Permissions

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