473,287 Members | 1,395 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,287 software developers and data experts.

Data Entry Using Form - How to Automatically update a Primary Key?

I have a database with multiple tables, all interlinked via referentially enforced relationships between pks and fks. I am attempting to produce forms which will allow the user to enter data that will end up in multiple tables. This part I can do successfully!

My problem lies with the primary keys. I have arranged the form with a subform that also contains a subform. In order for the primary keys for the various tables to be filled out I have put these fields within the different forms...simply put either the 'date' doesn't go into the primary key without the primary key field being present and what is filled in, OR it does but creates duplicates within the primary key field, depending upon the way that I arrange the forms.
Feb 15 '11 #1
6 4442
ADezii
8,834 Expert 8TB
Are your Link Child and Link master Fields properly set?
Feb 15 '11 #2
I assumed they were because of the relationships from the tables being correct, however, I am not sure how to check this after the form has been made?

I am also confused how it relates to the issue of either not filling the primary key field or producing duplicates in the primary key field?
Feb 15 '11 #3
ADezii
8,834 Expert 8TB
@Elizabeth, here is a Demo (Attachment) that I ofter use whenever I deal with Sub-Forms greater than 1 Level deep. The Demo shows how you can create Independent, Sub-Sub-Sub Forms without nesting Sub-Form Controls. Pay specific attention to:
  1. The Current() Event of the Cities and Schools Sub-Forms.
  2. The Link Child/Master Fields of all the Sub-Forms.
  3. The Relationships Window which graphically displays how the Tables are interrelated:
    Expand|Select|Wrap|Line Numbers
    1. State{1} ==> {MANY}Cities{1} ==> {MANY}Schools{1} ==> {MANY}Students
  4. How the Primary Key Values of the Sub-Forms are automatically populated.
P.S. - Any questions, feel free to ask.
Attached Files
File Type: zip SubForms.zip (31.6 KB, 184 views)
Feb 15 '11 #4
There doesn't appear to be any events in the properties of the Cities and Schools subforms?

How do I view the link child/master fields for the whole subform? do i have to click and look at the properties of all the fields until i find them?

The relationship is very simple and I guess makes this easier, my relationships 'tend' (so not always) to have a one pk -> 1+ fks <- another single pk and I am wondering if that makes a difference to the way the forms become set out?

The form is 'read-only' so I cannot edit, but I imagine you mean that fks are auto-filled when a pk is filled in? This I can do, however, I can't then use this field as it is a pk to enter data everytime for a different subform say, different data that happened to be on the same id or on the same date.

Thank you very much for helping :o)
Feb 15 '11 #5
ADezii
8,834 Expert 8TB
There doesn't appear to be any events in the properties of the Cities and Schools subforms?
The Cities and Schools Sub-Forms have Code in their Current() Events. Look at the Form itself, and NOT the Sub-Form Control.
How do I view the link child/master fields for the whole subform? do i have to click and look at the properties of all the fields until i find them?
Select the Sub-Form Control ==> Right Click ==> Properties ==> Data Tab
Feb 15 '11 #6
I am afraid I cannot find the Current() Events code, in all of the properties under 'events' there is nothing...
Feb 16 '11 #7

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

Similar topics

3
by: Carmela | last post by:
Hello Readers, I am trying to update data on a form that is based on a query having a many-to-one-to-many relationship. I found this exciting link that seemed to have the solution for me: ...
4
by: MLH | last post by:
On a data entry only form. lets say a user opens your form and enters 4 consecutive records. Each time, he clicks your SAVE button and a record is save and the record set is advanced to a newrec. ...
0
by: Art | last post by:
Hi, I'd appreciate any help or any references to aid me in working with a datagrid. I'd like to be able to enter data through a data grid. I'm using an Access database. I'm not sure about...
4
by: Robert | last post by:
Have main form with an unbound subform1 which is used for data entry. Subform1 has a nested continuous unbound subform (subform2) which is used to enter multiple records related to the record being...
2
by: badboybrown | last post by:
Good afternoon, Please can someone tell me the best way of calling up a form that will allow the user to only add new records. I have other forms that will be used to view the existing...
1
by: lesperancer | last post by:
I've got a form that is opened in readonly mode and no fields can be changed, great but if I click on a combo box that has an _enter() event that sets a field on my form to a value (albeit the...
1
by: BlackFireNova | last post by:
I'm using Access 2003, on Windows XP Pro. I have a subform which is launched from a command button on my main form. When this form opens, I have 2 fields which I have inserted VBA Code into to...
1
by: stv972 | last post by:
Im a newbie in vb programming. i got to learn the loops thru books and surfing the net. Nwys im making a program now and m using dbgrid where i want to add data directly to the grid. I have already...
0
by: sejal17 | last post by:
hello, I want to check the duplication of data entry using Ajax. I have the page below: cellphone no:textbox1(123) - textbox2(123) - textbox3(4567) And i have touch screen for...
1
by: Bigdaddrock | last post by:
In the interest of avoiding data entry errors, I am seeking a means of entering data (in this case mail address data) into a form , with subsets of that data being recorded into two separate tables. ...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.