Hi
I have a form containing a subform. The form is based on a query. I would like it so that (1) if the user enters the form and the query returns no records, a warning appears and they are returned to the switchboard; and (2) if the query returns record(s), the user can cycle through the available records - however, I have made it so, if the user clicks a certain command button, a particular record is updated so that it no longer meets the crieria for the initial query on which the form is based. This means that whilst the user is cycling through the available records, they may come to a point where no more records are available. I would like a similiar warning to appears, as in (1), if this happens.
I have tried the code below in forms on load, on open and on current event. The msgbox reveals that the record count is wrong. I have used the movelast code after looking through this forum re: recordcount. Does anybody know what I am doing wrong? Any help greatly appreciated...
Dim rst As Object
Set rst = Me.RecordsetClone
On Error Resume Next
rst.MoveLast
On Error GoTo 0
MsgBox rst.RecordCount
If rst.RecordCount = 0 Then
MsgBox ("All MDM decisions have been recorded.")
DoCmd.OpenForm "Switchboard"
DoCmd.close acForm, "frm_aftermdm"
Else
End If
cheers,
Bruce
I have a form containing a subform. The form is based on a query. I would like it so that (1) if the user enters the form and the query returns no records, a warning appears and they are returned to the switchboard; and (2) if the query returns record(s), the user can cycle through the available records - however, I have made it so, if the user clicks a certain command button, a particular record is updated so that it no longer meets the crieria for the initial query on which the form is based. This means that whilst the user is cycling through the available records, they may come to a point where no more records are available. I would like a similiar warning to appears, as in (1), if this happens.
I have tried the code below in forms on load, on open and on current event. The msgbox reveals that the record count is wrong. I have used the movelast code after looking through this forum re: recordcount. Does anybody know what I am doing wrong? Any help greatly appreciated...
Dim rst As Object
Set rst = Me.RecordsetClone
On Error Resume Next
rst.MoveLast
On Error GoTo 0
MsgBox rst.RecordCount
If rst.RecordCount = 0 Then
MsgBox ("All MDM decisions have been recorded.")
DoCmd.OpenForm "Switchboard"
DoCmd.close acForm, "frm_aftermdm"
Else
End If
cheers,
Bruce