R
robert d via AccessMonster.com
I have a form that can be opened from a number of other forms. It displays
data for a certain item. Typically, this form is opened when someone double
clicks on the item in a list box on some forms and a tree on another form.
The Form Load event needs to check that the item actually exists (it is
possible that someone could delete the item while having one of these other
forms open and then try to double-click on the item after it has been deleted)
..
So in the Form Load event I set up a DAO recordset that selects the item from
the table. After the recordset, here is what I have:
If rsCHECK.RecordCount = 0 Then
MsgBox "Can't find item!", vbOKOnly + vbCritical
DoCmd.Close acForm, Me.Name
GoTo Exit_Sub
End If
Exit_Sub is the Exit Handler that includes closing the open recordset.
Is this the proper way to set this up.
Thanks in advance.
data for a certain item. Typically, this form is opened when someone double
clicks on the item in a list box on some forms and a tree on another form.
The Form Load event needs to check that the item actually exists (it is
possible that someone could delete the item while having one of these other
forms open and then try to double-click on the item after it has been deleted)
..
So in the Form Load event I set up a DAO recordset that selects the item from
the table. After the recordset, here is what I have:
If rsCHECK.RecordCount = 0 Then
MsgBox "Can't find item!", vbOKOnly + vbCritical
DoCmd.Close acForm, Me.Name
GoTo Exit_Sub
End If
Exit_Sub is the Exit Handler that includes closing the open recordset.
Is this the proper way to set this up.
Thanks in advance.