Show MsgBox and Close Form

C

Carl Mankat

I know this is off topic but can someone point me to the correct place?
What is the equivalent to "RecordsetClone.RecordCount" For forms?

If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "Choose a room number between 1 & 44"
End If


Place your code in the form's Open event, then cancel the event if
there are no records.

Private Sub Form_Open(Cancel As Integer)
If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "Choose a room number between 1 & 44"
Cancel = true
End If
End Sub

TIA,
Carl
 
C

Carl Rapson

If I'm not mistaken, you can't use the RecordsetClone in the Form_Open
event, as the form has not yet been populated. You might try placing your
code in the Form_Load event, and calling DoCmd.Close to close the form.

HTH,

Carl Rapson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top