Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQL ? (access 2003 )

    Using the statement below to pull the email from the form. It works great but when the value is null in the email field I get an erorr of invalid use of null. Is there a way to modify this to handle null values. It's ok if the email address is blank.. Thanks.....


    SQL = [Forms]![Sites_Frm]![email]

    With MailOutLook
    .To = SQL

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

    Re: SQL ? (access 2003 )

    Try
    <code>
    .To = Nz(SQL, "")
    </code>
    The Nz function returns its first argument, unless that is Null, then it returns the second argument.

  3. #3
    3 Star Lounger
    Join Date
    Jun 2001
    Location
    Salem, Oregon, USA
    Posts
    219
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SQL ? (access 2003 )

    Just as a "pendantic" aside, and obviously not tripping you up here, but, I wonder if SQL is a reserved word, and something you might avoid from using as a variable?
    thx
    Pat

  4. #4
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: SQL ? (access 2003 )

    Hi Patricia

    That is an interesting conundrum:

    SQL Server 2000 - Not Reserved
    DB2 - Reserved
    ODBC - Reserved
    SQL Server Future Keywords - Reserved
    MySQL 5 - Reserved

    That is the ones I know it would be good to add to the list
    Jerry

  5. #5
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: SQL ? (access 2003 )

    ...and then saying that here is a list and you are correct <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    http://support.microsoft.com/default.aspx?...kb;en-us;286335
    Jerry

  6. #6
    3 Star Lounger
    Join Date
    Jun 2001
    Location
    Salem, Oregon, USA
    Posts
    219
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SQL ? (access 2003 )

    Thank you! I know Access can be forgiving, but I have been burnt before in another language or two -- so, now I avoid 'em! Thanks, Jezza.
    Pat

Posting Permissions

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