ramblinwreck
Registered User.
- Local time
- Yesterday, 18:37
- Joined
- Apr 13, 2007
- Messages
- 28
I have a command button that loads a form and I want the loaded form to display a certain record, based on the variable passed to the form load procedure (called strOrderNumberFromParts).
I cannot get the rsclone code below to work resulting in a run time error.
Appreciate the help.
I cannot get the rsclone code below to work resulting in a run time error.
Appreciate the help.
Code:
Private Sub Form_Load()
On Error GoTo Error_Handler:
'Dim db As Database
'Dim rst As DAO.Recordset
Dim rsClone As DAO.Recordset
Set rsClone = Me.RecordsetClone
With rsClone
.MoveFirst
.FindFirst "[chrordernumberfromparts] =" & strOrderNumberFromParts
If Not .NoMatch Then
Me.Bookmark = rsClone.Bookmark
Else
.AddNew
.MoveLast
End If
Close
End With
exit_procedure:
Close
Set rst = Nothing
DoCmd.Hourglass False
DoCmd.SetWarnings True
Exit Sub
Error_Handler:
On Error Resume Next
MsgBox "An error has occurred in this application. " _
& "Please contact your technical support person and tell them this information:" _
& vbCrLf & vbCrLf & "Error Number " & Err.Number & ", " & Err.Description, _
Buttons:=vbCritical, title:="Motorhome Maintenance Records"
Resume exit_procedure
Resume
End Sub