"runtime error 2105" cant go to specified record

G

Guest

Hi,

I have a Main form and 5 subforms, the sub forms are based within a tab
control so the user select which subform to go to.

I have a combo box on my main form that allows the user to select a Name and
upon select all details for that Name are returned to the forms. no problems

However I have noticed on a few occassions that the runtime error 2105 error
comes up when the user is in the combo box selecting a name.

I have tried checking for dirty.forms but there are none, also one of the
sub forms has a memo field, not sure if this is the cause of the problem or
not..

the combo box is unbound and the code very straight forward:

Sub Combo105_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[EMP_NAME] = '" & Me![Combo105] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

any suggestions here would be helpful.
 
G

Guest

It did not find the record, so you need to check for that:
Sub Combo105_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[EMP_NAME] = '" & Me![Combo105] & "'"
If Me.RecordsetClone.NoMatch Then
MsgBox "Employee Not Found", vbOkOnly
Me.Combo105 = Null
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End Sub
 

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