Results 1 to 3 of 3

Treat empty variable - Excel VBA

Threaded View

  1. #1
    Registered User
    Join Date
    12-19-2012
    Location
    Belo Horizonte, Brazil
    MS-Off Ver
    Excel 2007
    Posts
    3

    Treat empty variable - Excel VBA

    Dear,

    I would like to know how to treat an empty variable in an expression that sql query a table access 2007.

    I've read some articles about using the IS NULL and IS NOT NULL and made ​​a few unsuccessful attempts.

    I tried and did not work well:

    sql = "SELECT * FROM Registration"
    sql = sql & "WHERE Field1 = '" & variable1 & "' AND Field2 = '" & variable2 & "' AND IS NOT NULL Field3 = '" & variable3 & "'"
    In my example, the variable3 is empty.

    Anyone know how to say the words correctly write?

    Sorry if I wrote it wrong.

    At
    Last edited by Alvim; 12-20-2012 at 07:13 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1