simple query to count linked records

Statick

Registered User.
Local time
Yesterday, 21:36
Joined
Oct 17, 2019
Messages
13
Hi I'm a bit new to Access, although I have plenty of experience of programming SQL databases, doing everything through a Microsoft UI is a bit bewildering

I need help with two similar things which I cannot figure out

Firstly I need to query the number of linked records in a table shown in a subform, based upon the currently selected master record, and for this information to be available in a datasheet on the master form (so presumably I need to create a field based around this query in the master table). The tables and forms are working correctly but I cannot figure out how to build this query.

Secondly, in a similar scenario I need a field in the master table to hold the sum total of a given field in a list of linked records in a subform

The end result should mean that the datasheet view of the master table should be able to tell me for every record "X number of records linked in table 1" and "Y sum total of values linked in table 2"

I've done a lot of googling around this but every article I can find around building queries demonstrates how to select for a given value, eg all employees who live in "London", but never how to select only the linked records for the currently selected master record. I'm pretty sure I'm missing something really simple here but I just can't figure it out!



 
Hi. Welcome to AWF! You should be able to add the link between the master form and subform as a criteria to narrow down the results of your query.
 

Users who are viewing this thread

Back
Top Bottom