Results 1 to 7 of 7

Thread: Jet DB's - dealing with Nulls

  1. #1

    Thread Starter
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    550
    Listed, I'm extracting data from a jet db, and I occasionally get crippling errors when a field is null. What's the best way of dealing with this - do I really need to put an "If not isnull(" thing in EVERY line, just in case?

  2. #2
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ....

    The best way, of course, is not to put any null values in your database

    I think using IsNull() is the only easy way out. Of course, you can do one thing: omit this validation for those fields which cannot be null. But otherwise, you don't have much option.

    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  3. #3

    Thread Starter
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    550
    Damn.

  4. #4
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386
    Yup.
    If you can edit the database, remove all Null values and modify the design and give everything default values, that way you can never get a null anymore.
    Or write a function which will give you the value of the database, or when it was null, a default value ("" for strings, 0 for numeric, etc)
    But yeah it sucks....
    Hope this helps

    Crazy D

  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    If your errors are occuring because you are displaying the record data to a textbox (or simular)....

    Do this:


    Code:
    Text1.Text = "" & rst!fieldname
    Mark
    -------------------

  6. #6

    Re: Jet DB's - dealing with Nulls

    Quote Originally Posted by coox View Post
    Listed, I'm extracting data from a jet db, and I occasionally get crippling errors when a field is null. What's the best way of dealing with this - do I really need to put an "If not isnull(" thing in EVERY line, just in case?
    You can write an application function that tests for nulls and returns a default value if need to deal with null data correctly. This will keep your code cleaner because you won't have to repeat the `If Not IsNull(...)` check on each line.

  7. #7
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,913

    Re: Jet DB's - dealing with Nulls

    hahaha, Halloween is definitely approaching ... old posts arising from the dead.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

Posting Permissions

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



Click Here to Expand Forum to Full Width