Unbound Combo Box Value

I

Icy

Hello, could anyone please help. I have a unbound combobox as a lookup tool.
user can click on the user name listed in the combobox and it will trigger
the (after_update) event and the information for the user will be populate on
the record field.
Private Sub Combobox_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Me.Requery
Set rs = Me.Recordset.Clone
rs.FindFirst "[UserID] = " & Str(Nz(Me![Combobox], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

However, when I assign the value on the combobox via VBA.
User is the Main Form
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single,
Y As Single)
Forms![User].Form![UserID].Value = Forms![User]![User subform].Form![ID].Value
Forms![User].Requery
End Sub

The value on the combo box changed, but the record field did not change, it
still has previous record even after Requery command. I have tried combobox
on_change, on_gotfocus events, no luck so far. I also found the statement
listed below form microsoft website.
"when you change or enter data in these controls in the user interface.
These events also don't occur if you set the value of the control by using
Visual Basic."

Is there anyway this could be achived? Any assistances would be appreciated.
 
I

Icy

typo sorry
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single,
Y As Single)
Forms![User].Form![Combobox].Value = Forms![User]![User subform].Form![ID].Value
Forms![User].Requery
End Sub


Icy said:
Hello, could anyone please help. I have a unbound combobox as a lookup tool.
user can click on the user name listed in the combobox and it will trigger
the (after_update) event and the information for the user will be populate on
the record field.
Private Sub Combobox_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Me.Requery
Set rs = Me.Recordset.Clone
rs.FindFirst "[UserID] = " & Str(Nz(Me![Combobox], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

However, when I assign the value on the combobox via VBA.
User is the Main Form
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single,
Y As Single)
Forms![User].Form![UserID].Value = Forms![User]![User subform].Form![ID].Value
Forms![User].Requery
End Sub

The value on the combo box changed, but the record field did not change, it
still has previous record even after Requery command. I have tried combobox
on_change, on_gotfocus events, no luck so far. I also found the statement
listed below form microsoft website.
"when you change or enter data in these controls in the user interface.
These events also don't occur if you set the value of the control by using
Visual Basic."

Is there anyway this could be achived? Any assistances would be appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top