count

  • Thread starter Thread starter a
  • Start date Start date
A

a

I have sub form and master form
the data sheet sub form contain this data
serial roomtype GName
1 DBL ahsdkl
2 DBL addfdf
3 SNGL adds
4 Q jkdjfkd

the question is:
I want to but text box in main form count roomtype where roomtype =DBL
I want to but text box in main form count roomtype where roomtype =SNGL
I want to but text box in main form count roomtype where roomtype =Q
 
Try these ---
=DCount("[roomtype]", "YourTableName", "[roomtype] = 'DBL")
=DCount("[roomtype]", "YourTableName", "[roomtype] = 'SNGL")
=DCount("[roomtype]", "YourTableName", "[roomtype] = 'Q")
 
I have sub form and master form
the data sheet sub form contain this data
serial roomtype GName
1 DBL ahsdkl
2 DBL addfdf
3 SNGL adds
4 Q jkdjfkd

the question is:
I want to but text box in main form count roomtype where roomtype =DBL
I want to but text box in main form count roomtype where roomtype =SNGL
I want to but text box in main form count roomtype where roomtype =Q

How about a little subform on the mainform showing all the roomtypes and the
count of each? Base it on a Query

SELECT Roomtype, Count(*) AS CountOfTypes FROM yourtable GROUP BY Roomtype;

and make it a continuous subform showing the two fields.

John W. Vinson [MVP]
 
a said:
I have sub form and master form
the data sheet sub form contain this data
serial roomtype GName
1 DBL ahsdkl
2 DBL addfdf
3 SNGL adds
4 Q jkdjfkd

the question is:
I want to but text box in main form count roomtype where roomtype =DBL
I want to but text box in main form count roomtype where roomtype =SNGL
I want to but text box in main form count roomtype where roomtype =Q


You can put text boxes in the subform's Footer section to
calculate each total using expressions like:
=Sum(IIf(roomtype="DBL", 1, 0))

Then the main form text box can refer to the subform text
box using an expression like:
=subform.Form.totaltextbox
 
Back
Top