Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display record count in one subform / combo result in second subform

Status
Not open for further replies.

ApparentlyInept

Technical User
Mar 13, 2005
25
US
Need to display the number of records in Query subform over a result based on a combo box in a different subform so that it looks like this "# of records/combo result". Preferably into a label box.

Thought it might have looked something like this but I am obviously wrong cause its not working.

Label = "Form!Query.count" / "Form!Subform.Cmbo.Column(5)"

FYI using Access07 but file is in 02-03 format.

The Inept One
 
use a dcount using the same criteria.
 
Ok tried that, didn't work. Here is what I have, it is in the On Update of ClassCmbo

StudentRatio = "Form!Class_Query.DCount" / "Form!Class_Subform.ClassCmbo.Column(5)"

Class Query is a form built on a query of the same name and Class_Subform is the location I am attempting to put this.


 
Ok tried that, didn't work

Can we see what you tried? What did not work? Did you get the wrong value, error, something else? Did it look something like this in your text box?

=dcount("someField", "Class_Query") / [classCmbo].[column](5)
 
Got it to work in a standard text box, although it divided the results where I actually want it to show the two numbers. Is there something in Access07 that doesn't allow you to modify a label on the form? Could have sworn I'd done it on previous versions this is what I have that works in the text box

Text21 = DCount("*", "[Class Query]") / [ClassCmbo].[Column](5)
 
I actually want it to show the two number
= DCount("*", "[Class Query]") & "/" & [ClassCmbo].[Column](5)

Is there something in Access07 that doesn't allow you to modify a label on the form

No, but your code is way off.

Form: frmMain
sub form one control: subFrmCntrlOne
sub form two control: subFrmCntrlTwo
Control on sub form one with record count: txtBxCount
combo box on second sub with value: cboClass
lbl on second sub for display: lblStudentRatio

Assuming the code is on the main from. Should be something like:
Code:
private sub someEvent
  me.subFrmCntrlTwo.form.lblStudentRatio.caption = me.subFrmCntrlOne.txtBxCount & " / " & me.subFrmCntrlTwo.cboClass.column(5)

end sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top