Dcount type of function on a form

S

slickdock

What can I use on a continuous form to tell me when there are no records on
the form? I can't dcount the underlying query of the form, because the user
might further filter records on the form as well. I want to know the moment,
through additional filtering techniques, the form shows no records.

Thank you.
 
F

fredg

What can I use on a continuous form to tell me when there are no records on
the form? I can't dcount the underlying query of the form, because the user
might further filter records on the form as well. I want to know the moment,
through additional filtering techniques, the form shows no records.

Thank you.

I don't quite follow you here.
If there are no records to show, the form will show no records.

In any event, code the form's Current event:
If Me.RecordsetClone.RecordCount = 0 then
MsgBox "There are no records to show."
End If
 
S

slickdock

Thank you. How could I put the me.recordsetclone language in a condition for
a macro? I want to msgbox the user and then force the form to close.
 
D

Douglas J. Steele

Try Forms!NameOfForm.RecordsetClone.Count

(replace NameOfForm with your actual form name...)
 
S

slickdock

Thanks, Doug. Unfortunately, now I'm getting "object doesn't contain the
automation object 'Count.'
I tried it both of these ways in the macro conditions argument:

[Forms]![frmCal].[RecordsetClone].[Count]=0
and...
[screen].[activeForm].[RecordsetClone].[Count]=0

I prefer to use Screen.ActiveForm if possible, because this macro is called
from several forms. Hope you can help. You almost always can!!
 
D

Dirk Goldgar

slickdock said:
Thanks, Doug. Unfortunately, now I'm getting "object doesn't contain the
automation object 'Count.'
I tried it both of these ways in the macro conditions argument:

[Forms]![frmCal].[RecordsetClone].[Count]=0
and...
[screen].[activeForm].[RecordsetClone].[Count]=0

I prefer to use Screen.ActiveForm if possible, because this macro is
called
from several forms. Hope you can help. You almost always can!!

Douglas J. Steele said:
Try Forms!NameOfForm.RecordsetClone.Count


Should be ".RecordCount", not ".Count".
 
S

slickdock

Thanks! I actually just found it, and I was coming back to post the answer.
And it does work with screen.activeform.
Thanks both of you! good teamwork!

Dirk Goldgar said:
slickdock said:
Thanks, Doug. Unfortunately, now I'm getting "object doesn't contain the
automation object 'Count.'
I tried it both of these ways in the macro conditions argument:

[Forms]![frmCal].[RecordsetClone].[Count]=0
and...
[screen].[activeForm].[RecordsetClone].[Count]=0

I prefer to use Screen.ActiveForm if possible, because this macro is
called
from several forms. Hope you can help. You almost always can!!

Douglas J. Steele said:
Try Forms!NameOfForm.RecordsetClone.Count


Should be ".RecordCount", not ".Count".

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)
 

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

Similar Threads


Top