JS-Q5: Run time error 2105

J

Jack Sheet

Uff. Still having problems (Access 97)

I created a very simple form, that simply displays all of the fields in a
table, as text boxes with one exception which is a combo box. The idea is
to select a record from a drop-down list in the combo box, rather than using
the bar at the bottom of the form.

When I select a new record from the drop-down list I get the run time error
2105, and when I debug the row "Me.Bookmark...." is highlighted in yellow in
the following code. Any takers? Thanks.

Sub Combo50_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[Ref] = '" & Me![Combo50] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
 
J

Jack Sheet

I think I have a kludgy solution to this.
The problem appears to stem from the fact that I tried to set the combo box
to enable it to accept a new record. If I disable that option in the combo
box and then create a separate text box on the form for entering the same
field for a new record then it seems to work. Looks naff, though. Would
have preferred just one field on the form, then if I click on new record
that field would be blank and enable the user to enter the details direct
into the combo box.
 
D

Douglas J Steele

Are you sure that the FindFirst is actually finding anything?

Sub Combo50_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[Ref] = '" & Me![Combo50] & "'"
If Me.RecordsetClone.NoMatch = True Then
MsgBox "I couldn't find " & Me![Combo50]
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End Sub

It may be necessary to use Me.RecordsetClone.MoveFirst before you use the
FindFirst method.
 
J

Jack Sheet

Thanks, but it bombed out at the same line with same error message.
Not to worry, as you can see from my other post I have sort of given up on
that idea.

Douglas J Steele said:
Are you sure that the FindFirst is actually finding anything?

Sub Combo50_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[Ref] = '" & Me![Combo50] & "'"
If Me.RecordsetClone.NoMatch = True Then
MsgBox "I couldn't find " & Me![Combo50]
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End Sub

It may be necessary to use Me.RecordsetClone.MoveFirst before you use the
FindFirst method.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Jack Sheet said:
Uff. Still having problems (Access 97)

I created a very simple form, that simply displays all of the fields in a
table, as text boxes with one exception which is a combo box. The idea
is
to select a record from a drop-down list in the combo box, rather than using
the bar at the bottom of the form.

When I select a new record from the drop-down list I get the run time error
2105, and when I debug the row "Me.Bookmark...." is highlighted in yellow in
the following code. Any takers? Thanks.

Sub Combo50_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[Ref] = '" & Me![Combo50] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
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