T
Thierry
Having some troulbe with a basic action. Maintenance form open with AssetID
passed in via OpenArgs. Now I want to display the specific Asset record...
Using this code it works... but I'm puzzled by the error.
----------------------
' Move the active record
If Len(Me.OpenArgs) > 0 Then
Dim rs As Variant
Set rs = Me.RecordsetClone
rs.Find "AssetID = " & Me.OpenArgs
'Check for EOF. If at EOF reset to the first position in the
'recordset. Otherwise, if a match was found, move that record and
exit.
If rs.EOF Then
rs.MoveFirst
MsgBox "Record NOT Found. Starting at the first record.",
vbExclamation
Else
On Error Resume Next ' added this to overcome a coding
issue.
Me.Bookmark = rs.Bookmark
Me.Form.Bookmark = rs.Bookmark
End If
-----------------------
YOu can see I've added the REsume Next line so I can get the code to try
both the bookmark stmts. One works when there are no maintenance records for
the asset. The other works when there are records for the asset.
Is there a better way? I welcome any and all responses. Thanks.
Thierry
passed in via OpenArgs. Now I want to display the specific Asset record...
Using this code it works... but I'm puzzled by the error.
----------------------
' Move the active record
If Len(Me.OpenArgs) > 0 Then
Dim rs As Variant
Set rs = Me.RecordsetClone
rs.Find "AssetID = " & Me.OpenArgs
'Check for EOF. If at EOF reset to the first position in the
'recordset. Otherwise, if a match was found, move that record and
exit.
If rs.EOF Then
rs.MoveFirst
MsgBox "Record NOT Found. Starting at the first record.",
vbExclamation
Else
On Error Resume Next ' added this to overcome a coding
issue.
Me.Bookmark = rs.Bookmark
Me.Form.Bookmark = rs.Bookmark
End If
-----------------------
YOu can see I've added the REsume Next line so I can get the code to try
both the bookmark stmts. One works when there are no maintenance records for
the asset. The other works when there are records for the asset.
Is there a better way? I welcome any and all responses. Thanks.
Thierry