473,396 Members | 2,087 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,396 software developers and data experts.

Access: Populating Foreign Key with Primary Key using Forms

Hello,

I am creating a database for everyday use for my company. What I am struggling with is the following:

I have two tables. TABLE A: An AutoNumber is being used for the primary key. I created a form for this table so the information can be entered.

But for each record, there eventually will be an audit (TABLE B). I have a foreign key set up in TABLE 2 which is a number field. What I would like to happen is to create a command button from the form of TABLE A to open a form for TABLE B.

What I am having a problem with is getting my foreign key to populate with the AutoNumber of the primary key in TABLE A, thus always linking the two together.

Any sugggestions?

Thank you!!!
Mar 13 '07 #1
1 4740
MMcCarthy
14,534 Expert Mod 8TB
Hello,

I am creating a database for everyday use for my company. What I am struggling with is the following:

I have two tables. TABLE A: An AutoNumber is being used for the primary key. I created a form for this table so the information can be entered.

But for each record, there eventually will be an audit (TABLE B). I have a foreign key set up in TABLE 2 which is a number field. What I would like to happen is to create a command button from the form of TABLE A to open a form for TABLE B.

What I am having a problem with is getting my foreign key to populate with the AutoNumber of the primary key in TABLE A, thus always linking the two together.

Any sugggestions?

Thank you!!!
In the OnLoad Event of Table B's form put ...

Expand|Select|Wrap|Line Numbers
  1. Me.[ID Field] = Forms![FormA]![ID Field]
Mary
Mar 13 '07 #2

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

Similar topics

5
by: Steve Strik | last post by:
My Problem: I have created a database here at work that is exhibiting some very strange behaviour. Essentially the database is structured in a manner where one table is a master record table...
2
by: DataB | last post by:
Hi everyone! I have a forms problem. Bakground: I have created a number of tables. Of these, I have a main parent table (Personal Details) and a number of other child tables (Tax file No.,...
0
by: Rajesh Tiwari | last post by:
Hi Group, i have a foreign key in a table in sql server.i am using a dataset and populating it with the contents of this table.my problem is that i am not able to access the foreign key that i...
4
by: alexandre.brisebois | last post by:
Hi, I am using access 2003, I would like to know if there is an option to reorganize the tables in a maner that is readable, as we can do in sql sever 2000 or 2005. I have been given a database...
1
by: marksjy | last post by:
I have a small database with a primary key similar to a social security number (SSN). The tables are tied to the primary table via the SSN-type field with referential integrity. I have a number...
4
by: Don Do | last post by:
Help I built a form/subform/subsubform setup using the access forms wizard. I have a table1 = parent, table2 = child, table3 = (grandchild?). There will be multiple records in table2 that tie...
1
by: sjvandevoorde | last post by:
II am hoping someone out there will be able to give me some guidance, as I am about to give up. I have been working on this for some time and I think I have looked at it so much that I can't even...
5
AccessIdiot
by: AccessIdiot | last post by:
Or maybe why my username is AccessIdiot :P I just discovered the linked form functionality of the form wizard. I dumped the fields from two tables linked by a Survey_ID (autonumber primary key in...
1
by: ITHELP85 | last post by:
using SQL Server 2005 I have a table SALES_ITEM, users should be able to input the Primary Keys (ItemNumberSK and InvoiceNumber), and Qty. I want the ItemName and UnitPrice fields to update...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.