Record Count zero on form

  • Thread starter Thread starter Bonnie
  • Start date Start date
B

Bonnie

Hi folks! Using A02 on XP. I have a form and report that I
have put query criteria into so an administrator can only
pull their own records - where the field [Admin]
=CurrentUser(). I can put a message for 'no data
available' on the OnNoData Event Procedure in the report
but having trouble with the form. There is no "OnNoData"
event procedure on forms. I tried putting If RecordCount =
0 "OnOpen" but get the 'no data' msg for everyone. Is my
timing off? I just want to say 'There are no plans
assigned to the current user ID' and cancel the openform.
Is RecordCount the right way to go with this?

Thanks in advance for any help or advice on this!
 
Bonnie,

You can use RecordsetClone.RecordCount when testing whether a form has
records to show. Just put the following in the Open event of the Form:


If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "There are no records to review."
Cancel = True
End If


hth,
 
Thanks VERY much for the quick response. It works
wonderfully (but you already knew that). I truly
appreciate your help, I knew I was close. I love learning
stuff here!!!!!!!!!!
-----Original Message-----
Bonnie,

You can use RecordsetClone.RecordCount when testing whether a form has
records to show. Just put the following in the Open event of the Form:


If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "There are no records to review."
Cancel = True
End If


hth,
--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Hi folks! Using A02 on XP. I have a form and report that I
have put query criteria into so an administrator can only
pull their own records - where the field [Admin]
=CurrentUser(). I can put a message for 'no data
available' on the OnNoData Event Procedure in the report
but having trouble with the form. There is no "OnNoData"
event procedure on forms. I tried putting If RecordCount =
0 "OnOpen" but get the 'no data' msg for everyone. Is my
timing off? I just want to say 'There are no plans
assigned to the current user ID' and cancel the openform.
Is RecordCount the right way to go with this?

Thanks in advance for any help or advice on this!


.
 
You're welcome, Bonnie. Good luck with your project.

--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Bonnie said:
Thanks VERY much for the quick response. It works
wonderfully (but you already knew that). I truly
appreciate your help, I knew I was close. I love learning
stuff here!!!!!!!!!!
-----Original Message-----
Bonnie,

You can use RecordsetClone.RecordCount when testing whether a form has
records to show. Just put the following in the Open event of the Form:


If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "There are no records to review."
Cancel = True
End If


hth,
--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Hi folks! Using A02 on XP. I have a form and report that I
have put query criteria into so an administrator can only
pull their own records - where the field [Admin]
=CurrentUser(). I can put a message for 'no data
available' on the OnNoData Event Procedure in the report
but having trouble with the form. There is no "OnNoData"
event procedure on forms. I tried putting If RecordCount =
0 "OnOpen" but get the 'no data' msg for everyone. Is my
timing off? I just want to say 'There are no plans
assigned to the current user ID' and cancel the openform.
Is RecordCount the right way to go with this?

Thanks in advance for any help or advice on this!


.
 
Back
Top