Count the number of records in a subform

I have designed a booking detail form for hotel database. It contains a sub form which displays Room_No (text), Available(yes/no field) columns.

Requirement: I want to count the selected Room_No in the sub form and display it in the text box placed on main form.

For this, I used a Dcount function which is assigned in the control source of a text box. =Dcount("*", "{nameofsubform]")
But it is not working.
Also, the count for selected rooms should keep on changing as per the selection done in the sub form.

Kindly help me with a solution for counting the selected rooms on the sub form.

Sponsored Links:

Related Topics

MS Access 2007: Calculated field based on subform:
As part of a review assignment, I have been tasked with adding a calculated field to a form that will count the number of items listed in the associated subform. The subform is based on the table "tblProduct", and is a subform named "frmProductSubform". The Parent table is named "tblCompany".

The tables are related by ProductID, and CustomerID fields. The fields included in the subform a ProductID, ProductType, Price, and Unit.

I am trying to create a calculated field based on the subform that will count the number of line items in the subform for the Parent table Customer record. I have added a text field to the Parent table's detail section named "Number of Products", and attempted to build an expression "=Count([ProductID])" to count the records in the related subform, but all I get is "error".


Update Multiple Records With A Check Number
I have a form. Let's call it frmPayments. It would have a subform named frmPaymentsSub. The subform is made up of line items to be paid. Each record (line item) has an invoice number. I enter the check number in a field for each record.

Sometimes multiple records have the same invoice number. I added two queries to count the records for each invoice number and can display that on the screen, if needed. Here is what I need to know. Is there a way to make the following work?

If there are two or more records (line items) with the same invoice number, and I enter the check number in one of the records, can that check number be inserted automatically into theremaining records with the same invoice number?


Count of Entries in a Subform
This is my 1st post, Im kind of Teaching myself Access and am very new to it all

I have a query that I can run with no problems, the query is displayed as a table in a subform which is exactly how I want it.

In my table I have columns that are named (lets say) A, B, C,D
I would like to be able to count the number of records that are on that table , and display it on the main form.
I have in my footer of the subform a textbox which contains =Count([B])
If drag this to the Detail section of my subfom it displays the totals as a new column of the table, if I put it back to the footer where it should be then of course it does not display
But the trouble Im having with is that I cannot get the total to display on my main form (that the subform sits in) everything I try just wont work all I get is #name


Runtime Error 424: Object Required
I'm trying to count the number of records in a subform if a value in the subform matches a value in my main form...


subtracing the count values between to count queries
I have an access database where I have multiple queries that I have created in SQL view to produce a count number, more particularly, a count of the number of records meeting a certain criteria. One of the queries looks like the following in SQL view:

SELECT Count(*) As [Count Test]
FROM [Count Test]

My question is how do I created another query that will subtract the values produced by two queries? For instance Count Test1 - Count Test2 = Count Test3


Counting the records in a subform
I have a form that is used to receive Items. When an item is received it already has a material code and a unique serial number. the form has a subform where the serial numbers are scanned in.

there may be multiple items received therefore multiple serial number listed on the subform. I need a way to count the records.


Record Count
I would like to count the number of records in a query containing non-specific data (ie. "*") but I can't seem to get any values.

If I use a DCount on a form and use defined criteria then I get the record count, but I just want to count the number of records with data present in a particular column.


Counting number of records based on criteria
In a report I'm using in a reportfield the expression =Count(*) which gives me the total number of records showed in this report. I'm also want to know from a specific datafield in this report how many of them are showed.

Something like =Count([Field1]="999") In words. count the number of fields where the registered data is 999 When I'm using it as described above, then the output gave me the same number as with =Count(*)


Is it possible for me to count my records? how?
All these times, my posting has been about me trying to create a database. This is because I'm suppose to create this database as my Internship Project.

For now, I wanna know is it possible for us to COUNT our records. If u refer to the picture attached(End product), I need to know the count values for the number of drawings being issued to each DrawingNo.

So far when I tried to query, it only gives me the Field count records. But what I Need is Access to count the ROWS and not COLUMNS.

So is it possible for me to count the revision drawings on rows?

I really hope there's a way for me to do this, I'm still new to Microsoft Acces, so guide me


Calculation based on count of records in a query
I'm trying to create report that will have calculated values based on the number of returned records for a query. The query returns records based on the date, so the number of records returned will change day to day.

The calculations in the report should reflect the fluctuating number of records in the query.

So in the report, I have a text box with the Control Source:

=13.2+4.4*Count([QueryName].[FieldName])

Access seems to like the context okay (no error messages in Design View), but I get an error when I go to Report View. Is there some other way I should be telling it to count the number ofrecords in the query?


Countif count the number o records
I am trying to count the number of records that have criteria of FSL = 0, 1, 2, 3 and 4. After research this I found a way to do this was make a calculating IIf field then have a separate field do the count. This is what I've done but it is not working.

=IIf([FSL]=0,1,0) (named this field 0CountCal)
=Count([0CountCal])

Used the same formulas for 1,2,3 and 4


Count Values in Totals for Reports
How does count values for totals in layout view work? I was hoping that it would count unique values in a column - but it does not appear to. I have an ID number column in my report - and the report is sorted by date. The same person/ID can have activity on several different dates. so they can have multiple rows in the report. I am trying to count each unique ID number in this report so I can provide a unique headcount for this report. I tried count values, and it gives me the same number as count records. Is there a way to count unique values in a column to show a total at the end of the report


Count Results
I have a table with a list of suggestions in it, When I open the main screen, I have a subform in there linked to the table for the suggestions and have a text box in the form.

it checks a field called "activesuggestion", which I have as a yes/no box in the table.

In the text box in the form, I have used the =count to try and return the
number of new records added since last viewing the database

=Count([activesuggestion])

This returns all records in the table, but I would like to limit it to those which have the activesuggestion box checked. I tried the following, but this continues to return a "0" figure

=Count([activesuggestion])=true


Total Control Value in SubForm
I have a two controls on a continuous subform the row source for both is a query and Column(2) is a Name, Column(3) is a number.

These are displayed by setting Column Count and Column widths to suit. The whole picture is - the Main Form will have a Calculated Value I want to enter a number of entries in the subform and depending on the value allocated to each Name (location) I will then allocate a portion of the Total Cost to each name.

It's taken me ages to get a cascading combos where the 1st is on the Main and the Second is on the subform now I cannot total this value on my subform so until I can do this I cannot get apercent to allocate each Location Cost (does this make sense)

I'd hoped this might work but I don't think Column count can be used in an expression
=Sum([DestinationNo].[Column](3))
Also the subform record source is not the table where the values are stored which I feel is part of the problem


Counting 0 records in a report
For one report I am doing I need to count the number of records on the report and I need to show "0" if there are no records. the standard Count( ) method does not work with zero records. I have not been able to come up with a satisfactory approach.

I need to count the field "LNFN"

The no Data Event is not appropriate for what I need to do.


Report sort order based on a count or sum field
I have a report that uses a count field (=Count(*)). Which is the number of records found in a group and the report covers multiple groups. Is there a way to now get the report to order bythe count field, so that the group with the highest number of records is first in the report when printed?


unbound search field
All, I am working in a 2003 database. I have a form with a subform. There is an unbound field to select a tracking number that pulls up all the cooresponding records in the subform. I created an alternative search on the sales number to pull up the cooresponding records in the subform if I didn't have a tracking number.

It's not working and I've been trying for two hours to get this right.

When I search google on "searching the field, I only get help when the subform is already populated with records and just need filtering.

Why does the combo box work for the tracking number and not the sales number? The tracking number is used as a link child for the subform but it's also an unbound field to search. I cantfigure this out and I know its really simple.


search form
I am working in a 2003 database. I have a form with a subform. There is an unbound field to select a tracking number that pulls up all the cooresponding records in the subform. I created an alternative search on the sales number to pull up the cooresponding records in the subform if I didn't have a tracking number.

It's not working and I've been trying for two hours to get this right.

When I search google on "searching the field, I only get help when the subform is already populated with records and just need filtering.

Why does the combo box work for the tracking number and not the sales number? The tracking number is used as a link child for the subform but it's also an unbound field to search. I cantfigure this out and I know its really simple.


Count records from multiple tables
I am a beginner with access and was trying to count records based on different criteria from multiple tables to pull into one report. Lets say I have tables "Lates", "Obligations", and "Master".

I want to be able to count the number of records that within the first column that start with the letter J from table "Lates". I also want to count all records in the fourth column of the table "Master" where the contents of that column say "Basic" in them.

I need to count the number of records from table "Obligations" where column 7 contents equal "Yes".

I need to be able to put of these count numbers into one report and have no idea how to do this. Ifanyone could either tell me how to pull data into a report from three different tables or give me a good resource it would be greatly appreciated.


Entry count on subform (eg. "2/4" or '2 of 4")
As per the title, I'm looking for a way to have a subform display the number of records associated with the record Im viewing in the main form.

For example, a client may have multiple cases or files, which I have in a single form view in a subform. At the top I would like it to give the user an idea of how many entries there are and which of those they are viewing