No records in access 2007 form

G

Grimwadec

I have a form which on opening has certain fields populated from another
form, but most are populated from a query. If those fields populated from the
query are blank because there is no records returned from the query, I want
an error message warning there is no records built in to a further command
button on the form. I have tried IsEmpty focussing on the first numeric ID
field, and several other functions, to no avail. Help please!
 
P

PieterLinden via AccessMonster.com

Grimwadec said:
I have a form which on opening has certain fields populated from another
form, but most are populated from a query. If those fields populated from the
query are blank because there are no records returned from the query, I want
an error message warning there are no records built in to a further command
button on the form. I have tried IsEmpty focussing on the first numeric ID
field, and several other functions, to no avail. Help please!

Not a clue what you're talking about regarding the command button, but
figuring out if the form's recordset contains any records is trivial:

Private Sub Form_Open(Cancel As Integer)
MsgBox "Form shows " & Me.RecordsetClone.RecordCount & " records.",
vbOKOnly + vbInformation

End Sub

[OpenFormName].RecordsetClone.RecordCount will return the number of records
in the form's underlying data source.
 

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