Auto-entering 0 in combo box

maw230

somewhat competent
Local time
Today, 15:31
Joined
Dec 9, 2009
Messages
522
On my main form I have a combo box that is bound to a field Store_Num, and whose record source is a select query from an ODBC table containing Store related data.

When entering a new record in this field, Access automatically adds a zero to the end of the entry.

The query is limited to Store_Num > 30. So, for example, if I enter 31 Access will append a 0, and when I tab to the next field the Store_Num above is now 310 instead of 31.

I thought it was because the Default Value of Store_Num in the table that the main form is based on was = '0', so I changed it to be nothing, but that did not work.

I've read through the combo box properties many times, changing various things, but nothing has worked so far.
 
normally you would not show the store number in a combo box - you would show the store name related to the number, and select from that.

now (assuming your combo box is set to "limit to list") - the default mechanism to enter numbers is not to overwrite existing numbers, but to edit the entry. so, it starts at 0 , presumably because this is the default, and when you enter 31, it accepts it, becuase 310 is a "legal" store number.

so you could arrange for the default to be blank, or for the existing data to be cleared on entering the control in a new record, or to use more "normal" combo box behaviour, which is to search on the name, rather than the store number.

eg - If you KNOW what the store number is, you hardly need ot use a comob box!
 
so you could arrange for the default to be blank, or for the existing data to be cleared on entering the control in a new record, or to use more "normal" combo box behaviour, which is to search on the name, rather than the store number.

eg - If you KNOW what the store number is, you hardly need ot use a comob box!

It is a data entry form, where the user is given a store number to input, and so there is no reason to see the "name" which these stores don't have necessarily.

How can I arrange for the default to be blank? This seems like the simplest way to accomplish my goal.

Edit: Also, since you're right I don't need a combo box, how can I give a text box a Row Source, so that values entered must match a query?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom