Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update/Append Queries and Default Values

Status
Not open for further replies.

ebrooks54

IS-IT--Management
Dec 4, 2002
54
US
First, many thanks to the people in this forum that take the time to respond to questions. This is a great place to expand one's working knowledge of Access.

Second, an observation:
If the structure of a table says that a particular field has a default value of 0, I would have expected that any data that was added to the table that contains a null value for that field should automatically store the default value. I appear to be wrong in this logical conclusion.

Third, the question:
I have a link to a text file. I created an append query that reads the text file and appends it to a table that has default values of 0 on integer fields in its structure. After running the query, there are many records that contain nulls in the integer fields. Am I doing something wrong? Is there a preferred way to do this?

Thanks
 
I believe that your conclusion is not correct.

If you have a two-field table, both with default values of 0, and then append to only the first field, you will get the default values in the second field of 0.

If you run the same append query, but this time append 'NULL" to the second field, you will get Null values, not the default value of 0.

My guess is that the text field contains Null values and is appending those values to your table, which is not the same as the default value of 0. To test this, only append to the first field and see if you get the expected 0's in the integer field.

HTH

Make sense??



Sam_F
"90% of the problem is asking the right question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top