Using Recordsetclone to Show Total of Related Records

S

SubyRuby

I'm not sure how to accomplish the following and would appreciate any
advice.

Form: Project (PK: ProjectNum)
Related form: Tasks (FK: TaskProjectNum)

On the Project form, I have a button to open the Tasks form and view
all tasks associated with the project. I'd like to inform the user on
the Project form that there are X number of associated tasks (either
in some text, or on the button itself). Example: "Click to view tasks
(3)"

Can I manipulate the recordsetclone property to do this? (So far, I've
only used this property in referring to the recordset of the form that
I'm working with, not another related form.) I suppose it would have
to be filtered on the FK (TaskProjectNum).

So, I would need to show the total number of Tasks where
TaskProjectNum = ProjectNum. I'm just not sure how to do that with the
recordsetclone property.

Thanks in advance for any assistance.
 
U

UpRider

Take a look at the Dcount function in HELP.
Use it to count the number of occurances of the target key in the related
records file.

HTH, UpRider
 
J

John W. Vinson

I'm not sure how to accomplish the following and would appreciate any
advice.

Form: Project (PK: ProjectNum)
Related form: Tasks (FK: TaskProjectNum)

On the Project form, I have a button to open the Tasks form and view
all tasks associated with the project. I'd like to inform the user on
the Project form that there are X number of associated tasks (either
in some text, or on the button itself). Example: "Click to view tasks
(3)"

Can I manipulate the recordsetclone property to do this? (So far, I've
only used this property in referring to the recordset of the form that
I'm working with, not another related form.) I suppose it would have
to be filtered on the FK (TaskProjectNum).

So, I would need to show the total number of Tasks where
TaskProjectNum = ProjectNum. I'm just not sure how to do that with the
recordsetclone property.

Thanks in advance for any assistance.

Just bear in mind that there are no records stored in the Form - they're in
the Table!

I'd just use a textbox with a control source using something like

=DCount("*", "[TaskProjects]", "[TaskProjectNum] =" & [ProjectNum])

to count the records for this projectnum in the related table.
 
S

SubyRuby

John and UpRider:

Thank you for your posts! Your help is much appreciated.

Sincerely,

SubyRuby

I'm not sure how to accomplish the following and would appreciate any
advice.
Form: Project (PK: ProjectNum)
Related form: Tasks (FK: TaskProjectNum)
On the Project form, I have a button to open the Tasks form and view
all tasks associated with the project. I'd like to inform the user on
the Project form that there are X number of associated tasks (either
in some text, or on the button itself). Example: "Click to view tasks
(3)"
Can I manipulate the recordsetclone property to do this? (So far, I've
only used this property in referring to therecordsetof the form that
I'm working with, not another related form.) I suppose it would have
to be filtered on the FK (TaskProjectNum).
So, I would need to show the total number of Tasks where
TaskProjectNum = ProjectNum. I'm just not sure how to do that with the
recordsetclone property.
Thanks in advance for any assistance.

Just bear in mind that there are no records stored in the Form - they're in
the Table!

I'd just use a textbox with a control source using something like

=DCount("*", "[TaskProjects]", "[TaskProjectNum] =" & [ProjectNum])

to count the records for this projectnum in the related table.
--

             John W. Vinson [MVP]- Hide quoted text -

- Show quoted text -
 

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