Relationship Issue (1 Viewer)

Mark Nash

New member
Local time
Today, 06:18
Joined
Aug 5, 2021
Messages
8
Good morning all, from an absolute noob.

I am butchering the downloadable Task Manager available as standard with Acces 2016.

I have created a table with a list of clients (named IFA), and populated the table with the names of the IFA's, and created a field in the task table, so that I can later populate the table with the names of the IFA for each task, via forms & subforms, as well as a button or text box to enter the name of a new IFA. I am trying to create a relationship between the IFA table and the Task table. However when I try to create the relationship, i get the following. Can someone point me in the right direction?

Thank you

Mark

1628750699023.png
 

Attachments

  • 1628750617139.png
    1628750617139.png
    295.5 KB · Views: 176

Gasman

Enthusiastic Amateur
Local time
Today, 06:18
Joined
Sep 21, 2011
Messages
14,238
As it states, you need an index. I generally use an autonumber in all my tables?. That is always indexed and unique.
 

Mark Nash

New member
Local time
Today, 06:18
Joined
Aug 5, 2021
Messages
8
Thanks, yes, I tried to associate the autonumber field from the IFA table, to the IFA field on the task table, on a one to many basis, but when I do this I get a message saying that "Relationship must be on the same number of fields with the same data types". I know there is a simple answer somewhere, but I'm stuck
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:18
Joined
Sep 21, 2011
Messages
14,238
Normally you would have a PK for your IFA. As mentioned I always used an autonumber field.
That then becomes a foreign key in your Tasks table.
The tasks table would have it's own autonumber primary key.?

Might be quicker to upload your DB?, however you still need to understand the links and how it works?
 

Mark Nash

New member
Local time
Today, 06:18
Joined
Aug 5, 2021
Messages
8
Thanks Gasman, I will have to strip the data already on the DB before I can post it on here. However, from the relationship that already exists between the Contacts (ID) autonumber field on the Contacts table to the Assigned To Text field in the Task table, this works fine. I am just confused why a similar relationship cannot be setup from the IFA table? The attributes are exactly the same in each relationship
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:18
Joined
Sep 21, 2011
Messages
14,238
So post a picture of the relationships.?

You can just copy the tables and not the data?
Do not touch your current DB, make a copy and amend that.
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:18
Joined
Sep 21, 2011
Messages
14,238
So I would be using the ID in IFA table (calling it IFAID) and link to the IFA in tasks, BUT that would be a Long field and I would call that IFAFK at the very least, possible TaskIFAFK if the IFAFK is likely to be in other tables?
 

mike60smart

Registered User.
Local time
Today, 06:18
Joined
Aug 6, 2017
Messages
1,904
Also, as Gasman has stated the Autonumber in Contacts should be named IFAID then in the related Tasks table
there should be a related Foreign Key named IFAID - Number Data Type - Long Interger
 

jdraw

Super Moderator
Staff member
Local time
Today, 01:18
Joined
Jan 23, 2006
Messages
15,379
In general, many will advise you to avoid using names with embedded spaces.
Suggest: FeeCodes or Fee_Codes, LastName...

Since you are a self-confessed "noob", I recommend you work thru one of the tutorials from RogersAccessLibrary
listed in this link. There are several articles related to Database Planning and Design and Access at that link.
Good luck.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 01:18
Joined
Feb 19, 2002
Messages
43,233
When you use "ID" as the name of every PK, it is impossible to look at your tables and figure out which fields are supposed to match. How about ContactID --> ContactID or AssignedTo_ContactID if you want the FK to have a more specific name.

Relationships are ALWAYS between a FK and a data field which may or may not be a field of the PK in the child table. When the PK is an autonumber, the FK MUST be defined as Long Integer.

If you are using lookups on the table, you will be totally confused regarding data types among other things.
 

Users who are viewing this thread

Top Bottom