Combobox problem when selecting data

LB79

Registered User.
Local time
Today, 04:55
Joined
Oct 26, 2007
Messages
505
Hello,

I'm having a problem with a cbobox and I just cant see what’s gone wrong.
My cbobox is unbound and reads from a table. When clicked the cbo updates a txtbox with data from a hidden column.
This works fine, and the txtbox shows the data from the hidden column, but, after the txtbox has updated, the cbobox dislays the data from the first record of the table (the txtbox still shows the selected data). Does anyone know what this problem is?

Thanks
 
Maybe place the following in the Afterupdate of the combo

comboname = Null

Forgive me if this is wrong as i am a noob :)
 
Post your after_update code pls
 
Maybe place the following in the Afterupdate of the combo

comboname = Null

Forgive me if this is wrong as i am a noob :)

Not a bad idea;
Me.YourCmbName.Value = Null if you want to clear it
 
Hi and thanks for the suggestions but I'm not using an AfterUpdate event.

The rowsource of the combobox (cbo1) has 2 columns. Column 1 shows Name, column 2 shows email address. Column 2 is hidden in cbo1 so that only the name is showing in the combobox.
The way that the form should work is:

  • Select an option (name) from cbo1
  • txt1 displays the email address based on the choice of cbo1 using the control source “=cbo1.Column(2)”

This works fine but for some reason I cant quite see, after making the selection, txt1 shows the correct email address of the selection I made, but cbo1 value shows the first item of the combobox.
 
This is because you are addressing the hidden column in reverse. What you should be doing is using the after update event of the combo box to pass the contents of the known column to the text box. Don't forget also that columns are zero based so the first column is .Column(0).

David
 
Solved it... kind of... just deleted the combobox and reinserted it and it works fine now without after update.

Thanks for the advice anyway :)
 

Users who are viewing this thread

Back
Top Bottom