Recordset.Clone

  • Thread starter Thread starter el zorro
  • Start date Start date
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?
 
Split your .FindFirst into .MoveFirst and then .Find . ADO recordsets don't
have a .FindFirst method.


Rob
 
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?
 
Back
Top