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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Confused about loading unbound combo box.

Status
Not open for further replies.

gazolba

Programmer
Dec 4, 2001
167
US
All my combo boxes are on a tabbed form in a subform in another tabbed form. Because the subform (and all the combo boxes) are loaded when the main form is opened I left the 'rowsource' blank and dont load my combo boxes until they get the focus.
I hope you are with me........
In the onfocus, I chek the rowsource and if blank load the rowsource.

Now my question, what if I read a record before the control gets focus. How do I set the value in the combo box? Or, do I have to set the focus first?
The combo boxes have multiple columns, usually column 0 is the table value and column1 the displayed value.

What is happening is that when I try to update a record sometimes the combo box value is recognized and sometimes it is not. It appears to depend on whether or not the control ever got the focus.

This is all very confusing and is eating up my development time.
 
Sometimes it's difficult to diagnose without seeing it in action. If you would like to send me a copy of your db with no mission critical or secure data, just a few rows, I would be happy to take a look.

russregner@yahoo.com
 
How are ya gazolba . . . .

If your reading the [blue]texbox portion[/blue] of the combobox, then yes, it has to have the focus first.

Are you saying: You have a Main Form with a Tab Control; one of the Tabs has the SubForm; that SubForm has another Tab Control; it is here the comboxes reside?

cal.gif
See Ya! . . . . . .
 
Sorry the database is way too big to email and would take too much time to prep for sending.
Basically my question is can I to set the value of an unbound combo box that has no rowsource. Also will that value be retained after I load a rowsource?

Also I'm confused as to how to refer to a value in a multi column combo box:
what does 'cmbBox' refer to when I have 2 columns, it appears different to 'cmbBox.column(0)' or 'cmbBox(column(1)'
 
I'm sure it's too big too send that's why I said send a few rows in a copy. But no problem. Set the value in the code on an event like after update. cmb(0) and Cmb(1) are indeed column1 and column2.

Hope that helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top