Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box text will not update

Status
Not open for further replies.

MetalicPrism

Programmer
Apr 3, 2005
17
CA
I have used a combobox to select, from and add records to a table. It works great for this, however when the data control for the form is used to move to the next record. The combobox still displays the previous selection. If I bind the control to the field then Access will not alow selection from the combobox anymore. If I try to clear the field during the on current event of the form Access will not allow this either as it produces an error complaining about trying to alter the PK...... Any ideas?
 
This is normal behavior for an unbound combo. You can't set it to Null if it's bound and is a primary key in your table. You can set it to Null in the form's OnCurrent event if it is unbound. How are you populating the combo (when unbound)?

Ken S.
 
Hello Eupher

I am populating the combo box by the row source of the box.

The command is

SELECT Parts.PartID, Parts.[Part#] FROM Parts ORDER BY Parts.[Part#];

I did try to null out the text property of the combo on the current event of the form but it produces an error. I will double check that I did not do that while it was bound.

Thankks for the help
 
Thanks Ken

It works great when I Nulled the combo box. Interesting that you do not Null the text property specifically. Just the whole combo box
 
The .Text property is String, which can't be set to Null, while the .Value property, which is the default property, and what is used when assigning "the whole control", is a Variant.

Roy-Vidar
 
Yes thank you I was at the time tring to set the text property to what some would call a NULL string ... which would be an empty string. Thanks for the tip on the value property, it is good to know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top