Combo Box Value

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

Guest

I have a combo box with the following code:

Private Sub BucketCmb_BeforeUpdate(Cancel As Integer)
Me.refNoSet.Value = Me.BucketCmb.Column(1)
End Sub

My problem is that the table data field that my control box is displaying is
not a primary key and can contain duplicates. So, I need a user to be able
to type a value that is currently listed in the combo box that needs to be
the start of a new record and without setting Me.refNoSet.Value =
Me.BucketCmb.Column(1) set. Is there a way to do this? Thanks.
 
First, the code you posted really belongs in the After Update event of the
combo. Also, you don't need to use the Value property of the text box. It
is the default property. All you need is:
Me.refNoSet = Me.BucketCmb.Column(1)


Your question is puzzling. There is nothing to prohibit the user from
typing the value in the text box, but if the value is already in column(1) of
the combo, why don't you want to use it?
 
Thanks for the tip on my code.

There can be several records with a BucketCmb value of 123P, for example.
The field displaying this value is a combo box. If a user selects 123P from
the combo box for a new record, the refNoSet field is populated with the
value of Column1. For this new record, the user doesn't want the value of
Column1 set.
 
Either don't populate the text box in the After Update event of the combo or
just let the user type over whatever is in it.
 
That's what I figured! Thanks.

Klatuu said:
Either don't populate the text box in the After Update event of the combo or
just let the user type over whatever is in it.
 
Back
Top