A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Referential integrity and updating primary key



 
 
Thread Tools Display Modes
  #1  
Old March 17th, 2010, 08:23 PM posted to microsoft.public.access.tablesdbdesign
dynamic dd[_2_]
external usenet poster
 
Posts: 3
Default Referential integrity and updating primary key

I have Access 2000 on the job.
I have two tables [Inmate Demographics] (CDCR#, Last Name, First Name, and
DOB are the only fields) and [7362 Tracking] with many medical related
fields.

[Inmate Demo] Primary Key = ‘CDCR#’
[7362 Tracking]. No Primary Key

One [Inmate Demo] to many [7362 Tracking] relationship on ‘CDCR#’
Referential Integrity is checked with cascading updates

I have a form
Inmate Demographics is the main form with Record Source [Inmate Demographics]
7362 Tracking1 is the sub form with Record Source [7362 Tracking]

I set this up this way because the user wanted to be able to input the CDCR
number and have the rest of the inmate demographics pulled up (names and
DOB). This feature works as planned however, now I can’t add new records on
the Inmate Demo form. Here is the error message I am getting: “The
Microsoft Jet database engine cannot find a record in the table ‘Inmate
Demographics’ with key matching fields(s) ‘CDCR#’. I understand the reason
is that I have not previously entered the data in the table.
How can I get the update done on the Inmate Demographics form? I really am
frustrated and in need of help.


  #2  
Old March 17th, 2010, 11:32 PM posted to microsoft.public.access.tablesdbdesign
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Referential integrity and updating primary key

On Wed, 17 Mar 2010 12:23:01 -0700, dynamic dd
wrote:

You need a primary key in every table. Please add one right now. If
you can't think of a better one, simply add an Autonumber ID field.

Next your mainform. It needs to be bound to tblInmates (I'm using a
more standard naming convension as a suggestion to you. Single words
without funny characters so I don't have to use square brackets all
the time). If the user wants to enter some medical record, she first
finds the inmate record, for example Ctrl+F on the CDCR_No field.

The subform is bound to tblMedical. In the Relationships window you
drew the line between tblInmates.CDCR_No and tblMedical.CDCR_No, and
checked the box to enforce it. This is a critical step for data
integrity. Cascading updates can be off, because (I assume) CDCR_No is
a fixed inmate number that does not change.

The subform control has two critical properties: LinkMasterFields and
LinkChildFields. Set both of them to CDCR_No.
On the subform, drag the CDCR_No to the Header section of the form.
This will hide it when running in datasheet view. If you are using
another form view, make the field invisible. This is also a critical
step: the user is NOT to enter data in this field. It is only there
for the db engine to link the parent table to the child table.

Now you have the classic 1:M form set up, and it will work fine. When
a new inmate arrives, use the VCR buttons at the bottom of the form to
navigate to a new record. Fill out the CDCR_No and other fields on the
main form. Then medical records can be added (first the parent, then
the child).

HTH,

-Tom.
Microsoft Access MVP




I have Access 2000 on the job.
I have two tables [Inmate Demographics] (CDCR#, Last Name, First Name, and
DOB are the only fields) and [7362 Tracking] with many medical related
fields.

[Inmate Demo] Primary Key = ‘CDCR#’
[7362 Tracking]. No Primary Key

One [Inmate Demo] to many [7362 Tracking] relationship on ‘CDCR#’
Referential Integrity is checked with cascading updates

I have a form
Inmate Demographics is the main form with Record Source [Inmate Demographics]
7362 Tracking1 is the sub form with Record Source [7362 Tracking]

I set this up this way because the user wanted to be able to input the CDCR
number and have the rest of the inmate demographics pulled up (names and
DOB). This feature works as planned however, now I can’t add new records on
the Inmate Demo form. Here is the error message I am getting: “The
Microsoft Jet database engine cannot find a record in the table ‘Inmate
Demographics’ with key matching fields(s) ‘CDCR#’. I understand the reason
is that I have not previously entered the data in the table.
How can I get the update done on the Inmate Demographics form? I really am
frustrated and in need of help.

  #3  
Old March 17th, 2010, 11:42 PM posted to microsoft.public.access.tablesdbdesign
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Referential integrity and updating primary key

If your main form has the navigation buttons (arrows and record numbers in
the lower left corner) you should be able to click on the right most arrow
and add a new record.

--
Build a little, test a little.


"dynamic dd" wrote:

I have Access 2000 on the job.
I have two tables [Inmate Demographics] (CDCR#, Last Name, First Name, and
DOB are the only fields) and [7362 Tracking] with many medical related
fields.

[Inmate Demo] Primary Key = ‘CDCR#’
[7362 Tracking]. No Primary Key

One [Inmate Demo] to many [7362 Tracking] relationship on ‘CDCR#’
Referential Integrity is checked with cascading updates

I have a form
Inmate Demographics is the main form with Record Source [Inmate Demographics]
7362 Tracking1 is the sub form with Record Source [7362 Tracking]

I set this up this way because the user wanted to be able to input the CDCR
number and have the rest of the inmate demographics pulled up (names and
DOB). This feature works as planned however, now I can’t add new records on
the Inmate Demo form. Here is the error message I am getting: “The
Microsoft Jet database engine cannot find a record in the table ‘Inmate
Demographics’ with key matching fields(s) ‘CDCR#’. I understand the reason
is that I have not previously entered the data in the table.
How can I get the update done on the Inmate Demographics form? I really am
frustrated and in need of help.


  #4  
Old March 18th, 2010, 12:33 AM posted to microsoft.public.access.tablesdbdesign
dynamic dd[_2_]
external usenet poster
 
Posts: 3
Default Referential integrity and updating primary key



"KARL DEWEY" wrote:

If your main form has the navigation buttons (arrows and record numbers in
the lower left corner) you should be able to click on the right most arrow
and add a new record.

--
Build a little, test a little.


"dynamic dd" wrote:

I have Access 2000 on the job.
I have two tables [Inmate Demographics] (CDCR#, Last Name, First Name, and
DOB are the only fields) and [7362 Tracking] with many medical related
fields.

[Inmate Demo] Primary Key = ‘CDCR#’
[7362 Tracking]. No Primary Key

One [Inmate Demo] to many [7362 Tracking] relationship on ‘CDCR#’
Referential Integrity is checked with cascading updates

I have a form
Inmate Demographics is the main form with Record Source [Inmate Demographics]
7362 Tracking1 is the sub form with Record Source [7362 Tracking]

I set this up this way because the user wanted to be able to input the CDCR
number and have the rest of the inmate demographics pulled up (names and
DOB). This feature works as planned however, now I can’t add new records on
the Inmate Demo form. Here is the error message I am getting: “The
Microsoft Jet database engine cannot find a record in the table ‘Inmate
Demographics’ with key matching fields(s) ‘CDCR#’. I understand the reason
is that I have not previously entered the data in the table.
How can I get the update done on the Inmate Demographics form? I really am
frustrated and in need of help.

Karl,

Thank you for your help. I am able to enter the #,name and DOB on the form
but it will not update the Inmate Demo form. I just get the error message.
Dianne
  #5  
Old March 18th, 2010, 12:45 AM posted to microsoft.public.access.tablesdbdesign
dynamic dd[_2_]
external usenet poster
 
Posts: 3
Default Referential integrity and updating primary key



"Tom van Stiphout" wrote:

On Wed, 17 Mar 2010 12:23:01 -0700, dynamic dd
wrote:

You need a primary key in every table. Please add one right now. If
you can't think of a better one, simply add an Autonumber ID field.

Next your mainform. It needs to be bound to tblInmates (I'm using a
more standard naming convension as a suggestion to you. Single words
without funny characters so I don't have to use square brackets all
the time). If the user wants to enter some medical record, she first
finds the inmate record, for example Ctrl+F on the CDCR_No field.

The subform is bound to tblMedical. In the Relationships window you
drew the line between tblInmates.CDCR_No and tblMedical.CDCR_No, and
checked the box to enforce it. This is a critical step for data
integrity. Cascading updates can be off, because (I assume) CDCR_No is
a fixed inmate number that does not change.

The subform control has two critical properties: LinkMasterFields and
LinkChildFields. Set both of them to CDCR_No.
On the subform, drag the CDCR_No to the Header section of the form.
This will hide it when running in datasheet view. If you are using
another form view, make the field invisible. This is also a critical
step: the user is NOT to enter data in this field. It is only there
for the db engine to link the parent table to the child table.

Now you have the classic 1:M form set up, and it will work fine. When
a new inmate arrives, use the VCR buttons at the bottom of the form to
navigate to a new record. Fill out the CDCR_No and other fields on the
main form. Then medical records can be added (first the parent, then
the child).

HTH,

-Tom.
Microsoft Access MVP




I have Access 2000 on the job.
I have two tables [Inmate Demographics] (CDCR#, Last Name, First Name, and
DOB are the only fields) and [7362 Tracking] with many medical related
fields.

[Inmate Demo] Primary Key = ‘CDCR#’
[7362 Tracking]. No Primary Key

One [Inmate Demo] to many [7362 Tracking] relationship on ‘CDCR#’
Referential Integrity is checked with cascading updates

I have a form
Inmate Demographics is the main form with Record Source [Inmate Demographics]
7362 Tracking1 is the sub form with Record Source [7362 Tracking]

I set this up this way because the user wanted to be able to input the CDCR
number and have the rest of the inmate demographics pulled up (names and
DOB). This feature works as planned however, now I can’t add new records on
the Inmate Demo form. Here is the error message I am getting: “The
Microsoft Jet database engine cannot find a record in the table ‘Inmate
Demographics’ with key matching fields(s) ‘CDCR#’. I understand the reason
is that I have not previously entered the data in the table.
How can I get the update done on the Inmate Demographics form? I really am
frustrated and in need of help.

.
Tom,

I'm working on implementing the changes you suggested and will let you know
when I am finished. Thank you very much.

Dianne
  #6  
Old March 18th, 2010, 06:25 PM posted to microsoft.public.access.tablesdbdesign
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Referential integrity and updating primary key

What is the error message?

--
Build a little, test a little.


"dynamic dd" wrote:



"KARL DEWEY" wrote:

If your main form has the navigation buttons (arrows and record numbers in
the lower left corner) you should be able to click on the right most arrow
and add a new record.

--
Build a little, test a little.


"dynamic dd" wrote:

I have Access 2000 on the job.
I have two tables [Inmate Demographics] (CDCR#, Last Name, First Name, and
DOB are the only fields) and [7362 Tracking] with many medical related
fields.

[Inmate Demo] Primary Key = ‘CDCR#’
[7362 Tracking]. No Primary Key

One [Inmate Demo] to many [7362 Tracking] relationship on ‘CDCR#’
Referential Integrity is checked with cascading updates

I have a form
Inmate Demographics is the main form with Record Source [Inmate Demographics]
7362 Tracking1 is the sub form with Record Source [7362 Tracking]

I set this up this way because the user wanted to be able to input the CDCR
number and have the rest of the inmate demographics pulled up (names and
DOB). This feature works as planned however, now I can’t add new records on
the Inmate Demo form. Here is the error message I am getting: “The
Microsoft Jet database engine cannot find a record in the table ‘Inmate
Demographics’ with key matching fields(s) ‘CDCR#’. I understand the reason
is that I have not previously entered the data in the table.
How can I get the update done on the Inmate Demographics form? I really am
frustrated and in need of help.

Karl,

Thank you for your help. I am able to enter the #,name and DOB on the form
but it will not update the Inmate Demo form. I just get the error message.
Dianne

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:52 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.