update search combobox

inoxo

Registered User.
Local time
Today, 13:21
Joined
Sep 8, 2005
Messages
42
Hello,

I have a combobox on a form to search for a name in a table and do to the record. Classical.

When I find the record and then I move to the next record (with <page down>), then combobox does not update to the current record.

What sould I put in my code to force the combobox to always display the value (eg. name) of the current record, every time I move in the table. ?

Thanks for your tips !
 
I think I would simply clear the combo box if the user moved to another record in the forms onCurrent event:

me.myCombo = ""

???
 
Thanks for your answer.
This is not a solution however : the combobox is cleared indeed, but it doesn't display the value of the (new) current record when I move to the next one in the table.
 
It sounds to like you are expecting a search combo to act like a bound combo and they don't act that way. If you want the value to show up on each record then you will have to either bind it to a field (which then makes it not a search combo) or assign it a value via code (setting it's bound column value) based on whatever it is that would tie it to the record. We don't have enough information to give you specific code on that.

Ken's response SHOULD be correct IF you are using this combo for searches.
 
Here is the code attached to the search combo box (myCombo) :

Private Sub myCombo_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[idUser] = " & Str(Me![myCombo])
Me.Bookmark = rs.Bookmark
End Sub

When I select an idUser with the combo, the record is searched and displayed.
When I move to the next record, the combo does not update to the iduser of the new record.
Adding the line <me.myCombo = ""> before the line <End Sub> clears the combo value but does not display the idUser of the new record.
 

Users who are viewing this thread

Back
Top Bottom