Results 1 to 5 of 5
  1. #1
    lefty2cox is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    May 2013
    Posts
    163

    Null or 0

    I'm building a table. Some of the fields will store numbers. Those numbers will store foreign keys. I was planning on using forms with drop downs to provide the values from related tables.

    I can't figure out if I should have default values of null or 0 in these fields.



    My head is about to explode.

  2. #2
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    With all the fields that have number data type, those numbers are foreign keys and will be used in the combo boxes? Then the answer is no default.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    I will often have foreign keys default to 0 at the table level. Then, when I do data validation, I check for = 0. Or, in a query, I can use > 0.

  4. #4
    lefty2cox is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    May 2013
    Posts
    163
    Am I correct in assuming that no default would have null as a value? I was thinking that I would like that because I could use error handling in any VBA to deal with it. Am I not thinking correctly?

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    If you do not use a default and you do not assign a value, it will be Null. You can test for Null just as easy as you can test for 0. There may be an instance, maybe if you are using the Count() function, where an Empty field would require extra work for validation. I have always been in the habit of assigning values to my fields as soon as possible.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 01-22-2015, 10:30 AM
  2. Replies: 3
    Last Post: 11-13-2013, 08:56 AM
  3. If/Then Null based on Null Value of Another Field
    By vbpeterson in forum Queries
    Replies: 11
    Last Post: 06-05-2012, 05:00 PM
  4. Replies: 1
    Last Post: 02-23-2012, 02:27 PM
  5. Finding the Max Date and Null Values if Null
    By SpdRacerX in forum Queries
    Replies: 1
    Last Post: 02-03-2012, 06:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums