Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Sep 2002
    Location
    Indianapolis, Indiana, USA
    Posts
    80
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Building SQL (2002)

    I have a form that is comprised of text boxes. From this I build an "insert into" SQL statement and run with temporary query and Execute. Several of the fields can be null. Is it better to test each field for null and exclude it or assign a blank value while building the SQL statement? Opinions, caveates?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Building SQL (2002)

    What does "several of the fields can be null" really mean? Do you mean the textboxes on the form can be left empty, or do you mean fields in the underlying data being queried can contain nulls? Are you trying to use a Null value as a criterion or does it signify that any value is acceptable?
    Charlotte

  3. #3
    Star Lounger
    Join Date
    Sep 2002
    Location
    Indianapolis, Indiana, USA
    Posts
    80
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Building SQL (2002)

    The text boxes on the form can be left empty.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Building SQL (2002)

    Then all you need to do is only handle controls where data was entered. You can simply ignore any of them without a value in building the SQL.
    Charlotte

Posting Permissions

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