473,473 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to count the number of records are linked to a record in another table?

12 New Member
Hi, im doing a CD library database and i have two tables, "CD" and "CD Copies" linked by "Catalogue ID No" field. Bellow is a picture of what i mean (click the link below it if it doesnt work!):


https://picasaweb.google.com/1167658...75094040621826

I would like to return the number of "CD Coppies" a selected "CD" has, ie the number of highighted records in the picture.

Please RSVP! =)

Thanks in advance!

Ollie
Mar 14 '11 #1
3 2751
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
It depends a bit on where you want this information used/displayed.

If its part of your code, you can use Dcount. If its something you "just" want to show in a query or form, you can use a subquery, or a secondary query joined to your first, through the ID field.
Mar 14 '11 #2
Ollie Shotton
12 New Member
i just want to display it in a form textbox so i can say "No Of Copies" = "x"

also i dont know any VB so prefer not to use that!

how would i go about making the subquery/secondary query?

Thanks
Ollie
Mar 14 '11 #3
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
In that case I would make a secondary query, call it qry_CountCatID for example.

The SQL would look like this:

Expand|Select|Wrap|Line Numbers
  1. SELECT [Catalogue ID No], 
  2.        Count(Catalogue ID No) AS CountOfCatID
  3. FROM tbl_YOURTABLENAME
  4. GROUP BY Catalogue ID No;
You can then join this table to your main table by Catalogue ID No, and you have the counting field CountOfCatID available.
Mar 14 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data...
2
by: Lauren Quantrell | last post by:
I am using a stored procedure as the recordsource on an MS-Access2000 form: Forms!frmName.RecordSource = "dbo.myStoredProcedure" The stored procedure creates a temp table #Contacts and then...
4
by: sparks | last post by:
I am trying to fix a database that someone did about 4 yrs ago in access97. The main table just contains demographics and is on the main form of the database. It has a subform on a tab that...
3
by: colleen1980 | last post by:
Hi: Can any one please help me when user select 2 dates from DDLDate1 10/09/2006 and DDLDate2 10/12/06 and the name and it close the form. I need to create multiple records in the another table on...
1
seshu
by: seshu | last post by:
Hi everybody This is seshu i have a small doubt in mysql i have created a table to save the data about dialy attendence i am able to retrive all the as per my needs but the problem...
4
by: paulcrowsnest | last post by:
Hi everyone This is probably really simple, but it has me stumped. I have a form which gets its data from a table called "Dentistry", this table is linked to another table called...
3
by: Ron | last post by:
Hi all, I've got a form (frmOne) based on a query (qryOnFirstTable). On this form is a button that when pressed, needs to total the records in another query (qryOnSecondTable) and then shows...
1
by: Randoz | last post by:
I recieve an updated excel file with pers information every other week and when I go to import the data into my table the data is not updated for the records that are linked to a course table. I...
2
by: mfaisalwarraich | last post by:
Hi Everybody, I am using the following code to get the recordset of an external database. Dim dbPatients As Database Dim rsCountPatients As Recordset ' to count number of...
5
by: CoreyReynolds | last post by:
Hello, I am currently about to give up after scouring the internet for how to do this, it's probably a relatively novice answer, but I am a relatively novice user. I have three tables...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.