Problem with Change Event

A

aviscomi

I have a combobox on a form (cboComp_Num) and I have the following code that
runs with the Change Event for the cbo_Comp_Num:
Me.txt_Price_Zone = Me.Comp_Num.Column(1)
Me.txt_Comp_Name = Me.Comp_Num.Column(2)
Me.txt_Comp_Add = Me.Comp_Num.Column(3)
Me.txt_Comp_City = Me.Comp_Num.Column(4)
Me.txt_Comp_St = Me.Comp_Num.Column(5)
Me.txt_Comp_Zip = Me.Comp_Num.Column(6)

The code works fine; it populates all of the above text boxes. My problem is
that the values contained within the above text boxes are carried
over/displayed when the moves onto a New Record. Once the use selects a new
Comp_Num they do change; but I prefer not to have them displayed. Any
thoughts?

Thanks in advance!
Anthony
 
J

Jeff Boyce

It sounds like these text boxes are used to display values, and are not
bound (i.e., don't read/save values). If so, you'll need to tell the form
that the values in those text boxes are null when the combo box changes (you
handle this with the Change event (I'd use the AfterUpdate, but ?!), and/or
when the record changes (e.g., a new record).

One approach might be to add code to the form's OnCurrent event that sticks
a null in each of these.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
A

aviscomi

Thanks!
Jeff Boyce said:
It sounds like these text boxes are used to display values, and are not
bound (i.e., don't read/save values). If so, you'll need to tell the form
that the values in those text boxes are null when the combo box changes
(you handle this with the Change event (I'd use the AfterUpdate, but ?!),
and/or when the record changes (e.g., a new record).

One approach might be to add code to the form's OnCurrent event that
sticks a null in each of these.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Top