Access subform returning zero record entry as well as correct one

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a subform which is a datasheet view off all records using sample
number as a key. When the main form first loads this value is "" and also
loads up the subform which returns a single record for the samplenumber off
0. When a legitimate sample number is selected the correct samples are
returned however the single entry for samplenumber 0 still remains.
On a separate form I have the same concept happening however the 0 does not
appear, I have compared the 2 forms, subforms and queries that the subform
runs off and cannot find where the setting is or why one is showing the
record while one doesnt. any ideas?
 
Charlie said:
I have a subform which is a datasheet view off all records using sample
number as a key. When the main form first loads this value is "" and also
loads up the subform which returns a single record for the samplenumber off
0. When a legitimate sample number is selected the correct samples are
returned however the single entry for samplenumber 0 still remains.
On a separate form I have the same concept happening however the 0 does not
appear, I have compared the 2 forms, subforms and queries that the subform
runs off and cannot find where the setting is or why one is showing the
record while one doesnt. any ideas?


Do you actually have a sample record with a foreign key
value of zero? It sounds like you don't and you are just
seeing a blank new record. The new record would display
zero in the key field because you have the field's default
value (in the table) set. This is the default situation
when you add a field to the table and it is recommended that
you clear that default value setting.
 
Marshall,

You seem to be correct. After checking the default settings for the tables
it is returning those values. Is there anyway off turning this off without
getting rid off the default values? I have a very similar subform which
queries the same table but somehow this one doesnt have the default values.

thanks
 
The default value will be use automatically whenever you
don't supply another value **in a new record**. Default
values are irrelevant for existing records. Incorporating
that into your request, it sounds like you want the form to
disallow creating new records. If that is indeed what you
are asking for, then just set the form's AllowAdditions
property to No.
 
Back
Top