How to start automumber from 0?

jriano

Registered User.
Local time
Today, 10:54
Joined
Dec 9, 2003
Messages
45
I have a table with an autonumber field and a char field. I have a query that sorts that table by the a character field, and return the key field as well (the autonumber field).
I also have a form with a combobox that uses that query as its source, it displays the character field, but saves the key field in another table. In that other table, 0 is the default value for that number field, and I want it to keep that 0 when an invalid selection is made in the combobox (if someone types in anything that is not in the query), or if after an item has been selected the user changes his mind and wants to leave it blank (blank is not in the query, so it is not accepted)
So my question is: is there a way to set the field to 0 when the user types in into the combobox, or when he deletes what is in the combobox? (of course again, when such entry is not in the query)
I think I could solve this by having the autonumber start at 0, and assign the string "select" to it, but I do not know how to start an autonumber from 0 either. If there is any other better approach, I am open to sugestions.
Thanks for your help.
 
Not only what Pat said, but your description makes it clear that this autonumber field isn't REALLY an autonumber. Rather, it appears to have some meaning in the context of the record. Such a key isn't illegal but an autonumber field is inappropriate for such cases. You can compute the number separately or use a DMax or DCount function (DMax preferred) to find the last number, then add 1 to it.
 
I have a couple of reports using list boxes that do not show results when the values are null, that is basically why I have set many numeric fields to have a default of 0. After you guys have told me, I think I am just going to move all the records in position 1 to another position, and make 1 the default value, with the record 1 being blank or a "_Select" string so that it appears fist in all the comboboxes. Thank you very much
 

Users who are viewing this thread

Back
Top Bottom