existance of record

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
 
M

Mary

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
 

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