Combo box to be blank on opening form

  • Thread starter Thread starter Nick Bradbury
  • Start date Start date
N

Nick Bradbury

Hi

I have a form that is used to display a history of orders placed by
customers. A combo box is used to select the particular customer however it
defaults to displaying the first customer in the Customers table on opening
the form, is it possible to open this form without it selecting a customer.

Hope that makes sense.

Nick
 
You can cheat by creating a customer called " Default Customer", " Make
Selection", or something similar. You can also disable the combobox's
record source (make it unbound and set its row source = "") until it gets the
focus, but that would cause a delay which might annoy the users. One last
solution would be to modify the combobox's row source string to be a union
query where one of the datasets is a blank record. However, this again might
cause an annoying delay.
 
It sounds like the combo box is a bound control. If it is, it will always
show the first customer in the table. If you are using it to search, then it
really should be an unbound control.
 
Sorry about the multiple post. Hit post when I didn't really mean to.

As I said in my second post, if you want it to be empty, you will have to
make it an unbound control. A combo box used for searching for a record
should usually be an unbound control. A common way to do this is to have a
hidden text box that is the bound control and to use the After Update event
of the combo to populate the hidden text box.

The problem with a bound control for searching for a record is that as soon
as you update the value in the combo, it also updates the value in the record
source. You have now changed the company identifier for the current record,
which is probably not what you want.
 
Hi Klatuu

You wrote

A common way to do this is to have a
hidden text box that is the bound control and to use the After Update event
of the combo to populate the hidden text box.

Could you tell me the code for the After Update procedure, I am not familiar
with VBA I'm afraid

Thanks for your help

Nick
 
The only time you need to do this is for new records. Since I don't know the
names of your objects, this will be made up names:

If Me.NewRecord Then
Me.CustomerTextBox = Me.CustomerComboBox
End If
 
Back
Top