Using Recordsetclone to Show Total of Related Records

  • Thread starter Thread starter SubyRuby
  • Start date Start date
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.
 
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
 
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.
 
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 -
 
Back
Top