473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to require subforms to return results relative parent forms

Hi I am a self taught user of access and would appreciate some advice.

I have a main form which holds employee details.

1st continuous subform which shows which sites each employee is or has been working on.

A 2nd continuous subform which shows further details of the employee on each specific site such as start/end dates, car status, failure of 24month rule, etc.

The main form and subform are linked with no problems.

However, the links between the 2nd subform and main form are not correct.

For example:Employee A, is set up with contract number 123 (1st subform) and has a start and end date on the 2nd subform.

Employee B, is also set up on contract number 123 as he also works there but he has a different start and end date.

When you go back into employee A, the 2nd subform shows both data entries instead of only the one relevant to him, and vice versa.

Main form is linked by EEID to subform 1, subform 1 is linked by ContractNumberID to subform 2

I would appreciate some advice on the relationships which may resolve this and will apologise in advance if I have not provided enough information.

Thanks
Shona
Nov 1 '10 #1
5 1921
jimatqsi
1,271 Expert 1GB
You can use more than one column in the form linkage. Instead of selecting the fields directly, click on the little ... icon to get a graphical tool to use multiple columns for the lingage.

Jim
Nov 2 '10 #2
Hi Jim, Thank you so much for getting back to me. I have tried to add a 2nd link in the Child/Masterfields however I think that my relationships are wrong.

MainForm is Employee Information - EEID (Key)

- linked to the 1st subform using EEID

1st Subform is Site Info Table - SiteContractNumberID (Key)

- linked to 2nd subform using SiteContractNumberID

2nd Subform is employee site information - MileageID (key)

Between the main EE table and Site Info table I have the following relationship


LnkEESite Table - EEID (key) - duplicates OK
ContractSiteNumberID (key) - duplicates OK

This table is populated/links the 2 tables together - not sure if entirely necessary.

Mileage Info Table - is linked to the ContractSiteNumberID

I tried to have a link table between Site Info table and Mileage Info Table but nothing was being populated when entering data.

So it would appear that I need some kind of relationship between the Main Table - EEID and the Mileage Info Table so that the Mileage Info table only returns data relevant to both the Main EE table and 1st subform.

Thanks for your patience!!!!
Nov 2 '10 #3
jimatqsi
1,271 Expert 1GB
No, you do not need a direct relationship between the main form's record set and the 2nd subform. There must be an implied relationship, by virtue of the fact that the first subform must be related to both the main form and the 2nd subform.

The link from subform one to subform two should NOT have anything to do with LnkEESite Table - EEID (key). That is on the main form. You can only link subform 2 to subform 1 by using data items from those two forms/recordsets. In other words,
LnkEESite Table - EEID to ContractSiteNumberID - EEID
should be
ContractSiteNumberID - EEID to Mileage table's EEID

Jim
Nov 3 '10 #4
Jim

Sorry for the delay I have been away - thanks for getting back to me.

I will need to experiment further as I still cannot get the 2nd subform to only return the results relative to both the 1st subform and the main form.

The 2nd subform is still returning all records for a contract number in the 1st subform regardless of whether or not it is relevant to the main form - not sure where I am going wrong but I clearly have not got the relationships right - but thanks for the effort.

Shona
Nov 8 '10 #5
Hi

I managed to solve my subform problem and both now link correctly. :-)

However..........I there is now a problem with the requery.

When selecting an employee from the main from then clicking on to a record (contract number) on the 1st subform, the related records on the 2nd subform should show.

However, they only show after I have clicked on to a contract number on the first subform, clicked on to a different contract number and then clicked back to the first.

Any advice would be much appreciated.

Thanks
Shona
Nov 9 '10 #6

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

Similar topics

2
by: origin197511 | last post by:
Hello all... I'm having an issue with MSAccess 2000. I have a Form that holds records of my cartridge loads for a rifle and a subform that lists all groups that have been fired with that load. ...
1
by: Charles Ledbetter | last post by:
I'm missing the mistake. I have a MainForm called frmResources. I have a Second Form and related table called frmFootnotes. I am trying to use it as a subform to the main form appearing in a...
30
by: Shannan Casteel via AccessMonster.com | last post by:
I have a subform named "sbfrmParts" with a list of parts along with the quantity and price. I have used a text box in the subform's footer and set the control source to "=Sum(*)". I set the...
1
by: Mariel | last post by:
Hello, I hava a main form F1, form with a subform F2 in datasheet view. There is a combobox in the main form C1, and a combobox C2 in the subform. I want the dropdown options of the combobox...
4
by: drago | last post by:
Hi guys, I will be quick this time... Just want to know how we can calculate generic values in the same column. I am using invoice form with a services subform . I have a column of 'total' in subform...
2
by: darnnnel | last post by:
Hi everyone! I’m not sure how to even begin. I have a form and a subform and they are not linked. I would like to have a button on the form that would only change the data in the subform,...
15
by: pl626 | last post by:
In Access 2007, my subform has 3 controls that filter data from queries based on user selections from the preceding controls using the requery macro. It works fine when I have only the subform open....
4
by: AdamOnAccess | last post by:
Here's a strange situation: I'm building an application that contains a One-To-Many relationship, and the application has a main form with a sub form to maintain the relationship for data entry. ...
10
by: thayes5150 | last post by:
I have an access database that uses a subform to display records, one column of which is charge data (currency). My users need to verify the charges against the paper form they are scanned from, so...
1
by: Gordon Padwick | last post by:
I’m still having a problem with using a combo box in a main form to select records to be displayed in a subform. I’ve tried code suggested in several sources, but it doesn’t work. In “Filter records...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
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
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,...

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.