S
Stacey Crowhurst
Hi! I have a form that is having some coding issues. When I use the copy
record command I get run time error 2237. I deleted the lookup box on my
form and tried the copy record button and had no problems. When I reinserted
the lookup box, the error resumed. Here is all of the code on the form:
Option Compare Database
Private Sub Form_Current()
If Me.NewRecord Or IsNull(Me.prjParentProjectID) Then
Me.prjParentProjectID.Visible = False
Else
Me.prjParentProjectID.Visible = True
End If
End Sub
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
DoCmd.Close
Exit_cmdClose_Click:
Exit Sub
Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click
End Sub
Private Sub cmdCopyRecord_Click()
On Error GoTo Err_cmdCopyRecord_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Exit_cmdCopyRecord_Click:
Exit Sub
Err_cmdCopyRecord_Click:
MsgBox Err.Description
Resume Exit_cmdCopyRecord_Click
End Sub
Private Sub lkpCCPID_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[prjAutoNumberID] = " & Str(Nz(Me![lkpCCPID], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
The line of code that is highlighted as the problem is: If Not rs.EOF Then
Me.Bookmark = rs.Bookmark.
Any suggestions? Thank you very much!
Stacey
record command I get run time error 2237. I deleted the lookup box on my
form and tried the copy record button and had no problems. When I reinserted
the lookup box, the error resumed. Here is all of the code on the form:
Option Compare Database
Private Sub Form_Current()
If Me.NewRecord Or IsNull(Me.prjParentProjectID) Then
Me.prjParentProjectID.Visible = False
Else
Me.prjParentProjectID.Visible = True
End If
End Sub
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
DoCmd.Close
Exit_cmdClose_Click:
Exit Sub
Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click
End Sub
Private Sub cmdCopyRecord_Click()
On Error GoTo Err_cmdCopyRecord_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Exit_cmdCopyRecord_Click:
Exit Sub
Err_cmdCopyRecord_Click:
MsgBox Err.Description
Resume Exit_cmdCopyRecord_Click
End Sub
Private Sub lkpCCPID_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[prjAutoNumberID] = " & Str(Nz(Me![lkpCCPID], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
The line of code that is highlighted as the problem is: If Not rs.EOF Then
Me.Bookmark = rs.Bookmark.
Any suggestions? Thank you very much!
Stacey