Me.Bookmark = rs.Bookmark

F

Fred

when I try to run this query in the subform to fill in the fields I get error
on Me.Bookmark = rs.Bookmark
Can anyone help me fix this?


Private Sub Combo12_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[DistID] = " & Str(Me![Combo12])
Me.Bookmark = rs.Bookmark
End Sub
 
K

Ken Snell \(MVP\)

First, I suggest using the RecordsetClone property of the form, not the
Clone method of the Recordset property. Then, test to be sure that a match
is found before you set the bookmark property. Third, it appears that DistID
is a text field, so you must delimit the criterion value with ' characters.

Private Sub Combo12_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.RecordsetClone
rs.FindFirst "[DistID] = '" & Str(Me![Combo12]) & "'"
If rs.NoMatch = False Then Me.Bookmark = rs.Bookmark
Set rs = Nothing
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