MrMcFestoe
Technical User
I have a combo box on a form, the combo box gets its information from a table and the rest of the form also from the same table.
When a value is selected in the combo box and tab is pressed the rest of the fields on the form are filled in with the correct information ( at this point it works) if you keep pressing tab to go through all the fields in the form it comes back to the combo box then tab again to the next field, this is where it goes wrong the value in the combo box is related to a customer and if you keep pressing tab the information below the combo box goes through all the customer one by one even if the value in the combo box does not apply to them.
below is code which is on the combo box afterupdate.
Private Sub URN_AfterUpdate()
On Error GoTo ErrorHandler
Dim strSearch As String
strSearch = "[URN] = " & Chr$(39) & _
Me![URN] & Chr$(39)
'Find the record that matches the control.
Me.Requery
Me.RecordsetClone.FindFirst strSearch
Me.Bookmark = Me.RecordsetClone.Bookmark
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox "Error No: " & Err.Number & ": Description: " & _
Err.Description
Resume ErrorHandlerExit
End Sub
The value in the combo box can be made up of numbers and letters.
Any ideas what i have done wrong.
When a value is selected in the combo box and tab is pressed the rest of the fields on the form are filled in with the correct information ( at this point it works) if you keep pressing tab to go through all the fields in the form it comes back to the combo box then tab again to the next field, this is where it goes wrong the value in the combo box is related to a customer and if you keep pressing tab the information below the combo box goes through all the customer one by one even if the value in the combo box does not apply to them.
below is code which is on the combo box afterupdate.
Private Sub URN_AfterUpdate()
On Error GoTo ErrorHandler
Dim strSearch As String
strSearch = "[URN] = " & Chr$(39) & _
Me![URN] & Chr$(39)
'Find the record that matches the control.
Me.Requery
Me.RecordsetClone.FindFirst strSearch
Me.Bookmark = Me.RecordsetClone.Bookmark
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox "Error No: " & Err.Number & ": Description: " & _
Err.Description
Resume ErrorHandlerExit
End Sub
The value in the combo box can be made up of numbers and letters.
Any ideas what i have done wrong.