L
LAS
Why do I get a "no current record" error on Me.Requery??? The first query
certainly happens when there's no current record, and I have other forms
that open with no current record (sql parameters just return no rows), but a
Me.Requery works... I think...
If Not (fncDelCurrentRec(Me)) Then
MsgBox "An Error occurred in deleting the Incident!"
Else
Me.Requery THIS IS WHERE I GET A 'NO CURRENT
RECORD' ERROR
Call Refresh_Form
End If
Here is the code for fncDelCurrentRec. It works fine if there is a current
record before it's called. In the case where it doesn't work the record has
not yet been updated, but the user doesn't know that, of course.
Public Function fncDelCurrentRec(ByRef frmSomeForm As Form) As Boolean
With frmSomeForm
If .NewRecord Then
.Undo
fncDelCurrentRec = True
GoTo Exit_DelCurrentRec
End If
End With
With frmSomeForm.RecordsetClone
.Bookmark = frmSomeForm.Bookmark 'Move to the current record of the
passed form
.Delete
' frmSomeForm.Requery
End With
fncDelCurrentRec = True
Exit_DelCurrentRec:
Exit Function
Err_DelCurrentRec:
MsgBox (Err.Description)
fncDelCurrentRec = False
Resume Exit_DelCurrentRec
End Function
certainly happens when there's no current record, and I have other forms
that open with no current record (sql parameters just return no rows), but a
Me.Requery works... I think...
If Not (fncDelCurrentRec(Me)) Then
MsgBox "An Error occurred in deleting the Incident!"
Else
Me.Requery THIS IS WHERE I GET A 'NO CURRENT
RECORD' ERROR
Call Refresh_Form
End If
Here is the code for fncDelCurrentRec. It works fine if there is a current
record before it's called. In the case where it doesn't work the record has
not yet been updated, but the user doesn't know that, of course.
Public Function fncDelCurrentRec(ByRef frmSomeForm As Form) As Boolean
With frmSomeForm
If .NewRecord Then
.Undo
fncDelCurrentRec = True
GoTo Exit_DelCurrentRec
End If
End With
With frmSomeForm.RecordsetClone
.Bookmark = frmSomeForm.Bookmark 'Move to the current record of the
passed form
.Delete
' frmSomeForm.Requery
End With
fncDelCurrentRec = True
Exit_DelCurrentRec:
Exit Function
Err_DelCurrentRec:
MsgBox (Err.Description)
fncDelCurrentRec = False
Resume Exit_DelCurrentRec
End Function