T
Tom Lewis
I am new to ADO and am having trouble finding why the
following code does not work in my Access 2002 project:
Private Sub Form_Open(Cancel As Integer)
If Not IsNull(Me.OpenArgs) Then
Dim strFacilNum As String
strFacilNum = Me.OpenArgs
Dim rst As ADODB.Recordset
Set rst = Me.RecordsetClone
rst.Find "FacilityID = '" & strFacilNum & "'"
DoCmd.GoToRecord acDataForm, _
Me.Form.Name, _
acGoTo, _
rst.AbsolutePosition
End If
End Sub
When this runs I get an error that argument 4 has an
invalid value, which is because the Offset value
of "rst.AbsolutePosition" resolves to a value of negative
3. I cannot understand this; the position of the found
record is actually record 11347 of 11349, and I would
expect that the Offset would resolve to 11347. But since
the desired record is third from the end of the recordset
I suspect that the AbsolutePosition is counting backwards
from the end of the recordset. I have tried using
MoveFirst methods and specifying a forward search, but
none of this changes the result.
Any suggestions?
TIA,
Tom
following code does not work in my Access 2002 project:
Private Sub Form_Open(Cancel As Integer)
If Not IsNull(Me.OpenArgs) Then
Dim strFacilNum As String
strFacilNum = Me.OpenArgs
Dim rst As ADODB.Recordset
Set rst = Me.RecordsetClone
rst.Find "FacilityID = '" & strFacilNum & "'"
DoCmd.GoToRecord acDataForm, _
Me.Form.Name, _
acGoTo, _
rst.AbsolutePosition
End If
End Sub
When this runs I get an error that argument 4 has an
invalid value, which is because the Offset value
of "rst.AbsolutePosition" resolves to a value of negative
3. I cannot understand this; the position of the found
record is actually record 11347 of 11349, and I would
expect that the Offset would resolve to 11347. But since
the desired record is third from the end of the recordset
I suspect that the AbsolutePosition is counting backwards
from the end of the recordset. I have tried using
MoveFirst methods and specifying a forward search, but
none of this changes the result.
Any suggestions?
TIA,
Tom