Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I populate specific tables from specific fields in a form?

Status
Not open for further replies.

justanothertechie

Technical User
May 7, 2003
3
US
Hello,
I am a UNIX engineer and am new to Microsoft Access and VB. I have been tasked with creating a database that will consist of our entire inventory of Unix Systems, Storage, etc. Long story short, I have created several static tables that are already populated with choices. I also have four other tables that are not populated yet. These four tables are the ones I want all the records to be populated into. In otherwords, I have a form created. Some of the fields are text fields that you would enter new information into, other fields are drop down choices that are getting the choices from static tables. Once the form is completed with a record and you press the "add record" button, how do I tell access which fields get populated into which tables? I don't want just one huge table which is why I broke it down into four main population tables, which will also be used for running reports and queries and such. Any help would be appreciated. I apologize if I am asking too much for this forum. Thanks. jgoff
 
You need to set the underlying record source for the form to a query which has the fields from those tables. Then you set the control source for the form fields to be the appropriate field in the query. The record is automatically added this way.

Make sure the query which links the tables allows you to add records to it. I would set up relationships (under the Database menu) between the tables and use the "Enforce Referential Integrity" option. Also, make sure your tables have a primary key defined.
 
Forgive me, But I am unclear as to your comment. My question is not so much how to do queries against the date, but how to get the data into the tables I want it in. I have not yet entered any records into my form. When I enter my first record (for example), Say I am building a new system and adding it to the inventory. I enter the Host Name in the HostName field of the form, which is just text box, then I choose the platform and OS (for example) from choices in a drop down box. Then I press submit or add record. When I press add record, how do I tell my form that HostName field needs to populate HostName Field of SysID table and Platform field needs to populate Platform field of SysPlatform table?
Thanks again. jgoff
 
The general method is to set the Record Source property of your form to a table or query that includes the fields you want to update. Then set the Control Source of the text box(es) to the field(s).
It sounds like your form is currently not bount to a table or query. If this is the case, you would need to run either an update query/sql or code to open and update a recordset.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Ahh, From the two responses I got back, I have the answer I was looking for. I have been able to bind the fields of my form to specific fields in specific tables.

Thanks for your help.
jgoff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top