Recordset.Clone

E

el zorro

I am migrating an mdb database to an adp/SQL Server platform. On one of my
forms, when a user selects a record from a list, selected fields for that
record are displayed on the form. In Access mdb, I do this with VBA code on
the after Update event for the list:

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

Set rs = Me.Recordset.Clone
rs.FindFirst "[primaryfield] = " & Str(Me![List17])
Me.Bookmark = rs.Bookmark
End Sub

THis doesnt work in adp. I gert an error message that says "Object doesn't
support this property or method."

If this is relevant, in the adp version, the List is populated by an SQL
view that the form is also based on (in the mdb version it was a query).

Do I need a totally differnt approach now, or can this VBA code be tweaked
to work?
 
R

Robert Morley

Split your .FindFirst into .MoveFirst and then .Find . ADO recordsets don't
have a .FindFirst method.


Rob
 
E

el zorro

That solved it. Thanks!

Robert Morley said:
Split your .FindFirst into .MoveFirst and then .Find . ADO recordsets don't
have a .FindFirst method.


Rob

el said:
I am migrating an mdb database to an adp/SQL Server platform. On one of my
forms, when a user selects a record from a list, selected fields for that
record are displayed on the form. In Access mdb, I do this with VBA code on
the after Update event for the list:

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

Set rs = Me.Recordset.Clone
rs.FindFirst "[primaryfield] = " & Str(Me![List17])
Me.Bookmark = rs.Bookmark
End Sub

THis doesnt work in adp. I gert an error message that says "Object doesn't
support this property or method."

If this is relevant, in the adp version, the List is populated by an SQL
view that the form is also based on (in the mdb version it was a query).

Do I need a totally differnt approach now, or can this VBA code be tweaked
to work?
 

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

Similar Threads


Top