A
Afrosheen via AccessMonster.com
Thanks for reading this post and helping me out. What I'm trying to do is to
close my program if there are no records, but I'm getting a runtime error
2585. This action can't be carried while processing a form or report event.
Here's my code
Private Sub Form_Current()
Dim rsClone As Recordset
15 pictdisplay
20 If Me.RecordsetClone.RecordCount = 0 Then
50 Call MsgBox(" End of Records on file ", vbInformation, Application.
Name)
60 DoCmd.Close
70 End If
80 Set rsClone = Me.RecordsetClone
90 rsClone.Bookmark = Me.Bookmark
100 rsClone.MovePrevious
110 cmdFirst.Enabled = Not (rsClone.BOF)
120 cmdPrevious.Enabled = Not (rsClone.BOF)
130 rsClone.MoveNext
140 rsClone.MoveNext
150 cmdNext.Enabled = Not (rsClone.EOF)
160 cmdLast.Enabled = Not (rsClone.EOF)
'********** Closes the Cloned Recordset ****************
170 rsClone.Close
end sub
The problem line is 60
close my program if there are no records, but I'm getting a runtime error
2585. This action can't be carried while processing a form or report event.
Here's my code
Private Sub Form_Current()
Dim rsClone As Recordset
15 pictdisplay
20 If Me.RecordsetClone.RecordCount = 0 Then
50 Call MsgBox(" End of Records on file ", vbInformation, Application.
Name)
60 DoCmd.Close
70 End If
80 Set rsClone = Me.RecordsetClone
90 rsClone.Bookmark = Me.Bookmark
100 rsClone.MovePrevious
110 cmdFirst.Enabled = Not (rsClone.BOF)
120 cmdPrevious.Enabled = Not (rsClone.BOF)
130 rsClone.MoveNext
140 rsClone.MoveNext
150 cmdNext.Enabled = Not (rsClone.EOF)
160 cmdLast.Enabled = Not (rsClone.EOF)
'********** Closes the Cloned Recordset ****************
170 rsClone.Close
end sub
The problem line is 60