X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Ms Access Subdatasheet, Access 2016    
post Jul 29 2019, 03:56 AM

Posts: 18
Joined: 11-July 19

I would like to connect a Payslip with Sub Payslip to an EmployeeID

I have the EmployeeID on the PayslipMain and PayslipSubForms
I Have the PayslipID on the Subdatasheet aswell(?)

If I link the files I get The PayslipMain as a subdatasheet on the EmpID(Correct) BUT then I get ALL the PayslipSubs for all employees as a SubDataSheet to the PaySlipMain instead of only the Payslipsub for the relevant employee. I have tried all relationsship Types. I think that it must be either a wrong relationship or a wrong Primary Key.

Must I maybe Create 1 PayslipForm with all fields instead of a PaySlipMain with a PaySlipSub.
This post has been edited by Makya: Jul 29 2019, 04:19 AM
Go to the top of the page
post Jul 29 2019, 08:25 AM

UA Admin
Posts: 36,043
Joined: 20-June 02
From: Newcastle, WA

Perhaps it would help to understand a couple of things in more detail.

First, I assume you mean something like this:

Attached File  SubDatasheet.jpg ( 215.38K )Number of downloads: 7

If so, I should mention that I never use Subdatasheets with tables for a couple of reasons.
They are pointless, IMO. In a fully developed MS Access Relational Database Application, users NEVER see the tables directly, so having Subdatasheets in them has no value or benefit.
Also, they have been linked to slower performance in some cases, especially with larger tables with many records. I suspect that's less of a problem with newer, faster computers. But in the absence of any good reason to implement them, why take the risk?

However, assuming that you intend to go ahead with this design, the first step is to designate the proper Primary Key and Foreign Key for the two tables and then use those as the "Link Master Fields" and "Link Child Fields" in the Property Sheet.

I do not think EmployeeID is the right field to be looking at here, unless you are thinking about the relationship between the Employee table to the Payslip table. Each employee has one or more payslips, which is the one to many relationship that is the backbone of all Relational Database Applications. So, you'll designate a relationship between these two tables on EmployeeID, making sure you enforce referential integrity.

Then you have a third table, which is the "SubPayslip", which has details about each payslip. Since we can't see your actual tables, I have to assume that this table has things like shifts worked for the period covered by the Payslip, which is another one to many relationship. That means you designate the relationship between Payslip and SubPayslip on the Primary Key in Payslip and the corresponding Foreign Key in SubPayslip. That would have to be PayslipID.

So, to set up a subdatasheet for this two tables, the "Link Master Fields" and "Link Child Fields" will be PayslipID.

Again, I wouldn't do this at all as a Subdatasheet (assuming we mean the same thing here), but if you do it, that's how.

Make sure, though, that you designate the proper Primary and Foreign Keys in the Payslip and SubPayslip tables, using the PayslipID.
This post has been edited by GroverParkGeorge: Jul 29 2019, 08:27 AM

My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
post Jul 29 2019, 12:44 PM

Posts: 18
Joined: 11-July 19

I is exactly what I mean.

Let me try and make use of queries and maybe reports to substitute the SubDatasheet. This is a huge learning curve for me and a really complicated Database to tackle. At first it really seamed so straight forward.

Thanks for your suggestions and help.
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    17th November 2019 - 12:34 AM