473,804 Members | 4,153 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

26 New Member
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 4473
ADezii
8,834 Recognized Expert Expert
Are your Link Child and Link master Fields properly set?
Feb 15 '11 #2
Elizabeth Mitte
26 New Member
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 Recognized Expert Expert
@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
Elizabeth Mitte
26 New Member
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 Recognized Expert Expert
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
Elizabeth Mitte
26 New Member
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
2823
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: http://support.microsoft.com/?kbid=304473 I referred to the part in it that says:
4
1873
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. I don't know how to prevent the user from pressing the PGUP key or other keystrokes to back up a record or two. Its not exactly what I want them to do and sometimes causes data entry errors. Is there a way in A97 or Access 2.0 to prevent a...
0
1506
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 directly linking the datagrid to the database. I have done that to view data, but I'm not so sure about entering data. I was thinking that if the datagrid can be used sort of like a spreadsheet,
4
2721
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 entered in subform1. Am using DAO method to save the records entered into subform1 & 2 into the underlying tables (table1 & table2). Record being entered in subform1 only gets its unique identifier when saved to underlying table (primary key...
2
8126
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 records. Many thanks. SEAN
1
1826
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 same value it currently has), the form becomes 'dirty' and from that point on, I can changed any data in any field and I checked the .allowEdit setting, and it is still false, which is misleading me ?
1
4846
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 capture the information in two of the fields on the main form, so I can sync and track the data entered into the subform to the record on the mainform. In the "Got Focus" event of each of the two fields I've inserted the following code, to capture...
1
2445
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 textboxes coded for data entry but i recently found out that i can directly enter data using the grid. I already set custom properties of dbgrid AllowAddNew, AllowDelete and AllowUpdate to true but it seems the grid is still lock even though there...
0
1006
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 entering the no.when i enter the no with touch screen in the last textbox,i want to check that whether that no already exist in the database,if not thaen error message will be displayed.After that checking the next data is displayed that is: ...
1
2095
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. I cannot merely record the Record ID of one table (with the details) into the second table, since I must "freeze" the data in the second table at the time of entry, while the first table's record may be revised at some later date. (The first is a...
0
9585
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10586
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.