existance of record

  • Thread starter Thread starter Mary
  • Start date Start date
M

Mary

Can anyone provide guidance, please?

Normally I open a form. This works fine, but if no record
exists in the recordset I get a blank form. I wish to not
open a blank form; only open if record is present.

How do I test the recordset to determine whether a
particular record exists and not open the form?

I am a novice user of Access2000.

Thanks in advance,
M
 
Thanks, Howard.

I get an application or object defined error highliting
the If statement line.

My form being opened is "frm1VE" and its Option Explicit.

My code:

Option Explicit
-----------------
Private Sub Form_Load()
If Forms("frm1VE").HasData = True Then
Exit Sub
Else
DoCmd.Close acForm, "frm1VE", acSaveNo
MsgBox "There is no data in the selected form."
End If

End Sub

What do you think?
M
 
Back
Top