Subform record counter on main form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form (frmLicenses) with a subform (frmAssigned). frmLicenses has a
number field that holds how many licenses we have for each item. I would
like to create a field on frmLicenses that calculates how many licenses have
been assigned (eg how many records on the subform) and/or how many licenses I
have remaining.

Is this possible and if so, how do I do it? I'm very basic when it comes to
code.
 
Gillian,

No code required for this. In the Form Header or Form Footer of
frmAssigned, put an unbound textbox with its Control Source set to..
=Count(*)

It may serve your purposes to just leave it there. However, if you want
it to show on the main form instead, change the Visible property of the
textbox on the subform to No, and then put another textbox on the main
form and set its Control Source property to...
=[frmAssigned]![TextboxName]
.... relacing TextboxName with the actual name of the Count textbox on
the subform.

If you want to see remaining licences, put this in the Control Source of
a textbox on the main form...
=[Licences]-[frmAssigned]![TextboxName]
 
Thank you!
--
Thanks,
GillianHG


Steve Schapel said:
Gillian,

No code required for this. In the Form Header or Form Footer of
frmAssigned, put an unbound textbox with its Control Source set to..
=Count(*)

It may serve your purposes to just leave it there. However, if you want
it to show on the main form instead, change the Visible property of the
textbox on the subform to No, and then put another textbox on the main
form and set its Control Source property to...
=[frmAssigned]![TextboxName]
.... relacing TextboxName with the actual name of the Count textbox on
the subform.

If you want to see remaining licences, put this in the Control Source of
a textbox on the main form...
=[Licences]-[frmAssigned]![TextboxName]

--
Steve Schapel, Microsoft Access MVP

I have a form (frmLicenses) with a subform (frmAssigned). frmLicenses has a
number field that holds how many licenses we have for each item. I would
like to create a field on frmLicenses that calculates how many licenses have
been assigned (eg how many records on the subform) and/or how many licenses I
have remaining.

Is this possible and if so, how do I do it? I'm very basic when it comes to
code.
 

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

Back
Top