count

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
 
G

Guest

Try these ---
=DCount("[roomtype]", "YourTableName", "[roomtype] = 'DBL")
=DCount("[roomtype]", "YourTableName", "[roomtype] = 'SNGL")
=DCount("[roomtype]", "YourTableName", "[roomtype] = 'Q")
 
J

John W. Vinson

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]
 
M

Marshall Barton

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
 

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