Two Tables - How to use them both on form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two tables
Table1: has fields for Last name, First name, phone number
Table2: User last name, first name, question asked, and question answered

How would I go about making a form so it is able to call the information
from table1 then input that same information into table2?

For example:
Say i put in the name
John, Smith, 911-911-9111

When i goto forms i am able to pull up his information by making table1 a
record source. However I want to pull up John Smith and phone number then
also update thsi same record into table 2 and add more information on what
his question is.

Does this make sense?
 
Hi, Rigas.

When you find yourself trying to duplicate information from one table into
another, it should be a red flag that the design of your data is less than
optimal. In designing a relational database application, think in terms of
"things" (tables) that have "attributes" (fields)--e.g., People, Questions,
etc. Don't duplicate data from one table to another--the only field you need
to include is one corresponding to the related table's primary key--called a
foreign key (FK). The FK "unlocks" the related table, allowing you "Access"
to any of its fields.

For example, if you're storing data in Questions for a person stored in the
related table People, store ONLY the People's numeric primary key. You can
easily *display* the name fields by basing your data input form that includes
the fields from Questions and the name fields from People.

See a good reference on "database normalization".

Hope that helps.
Sprinks
 
thanks for your help but still ...
I really need to make so that I have one table with the Employee information
one table with question they asked but also populates the information of
employee automatically from the employee information table

how would i go about doign this?
 
Rigas,

I suspect you mean display the information from the Employee table once you
have selected the Employee. If this is the case, you have two options:

1. Base your Question data input form on a query that includes the Employee
fields you wish to display, and all the fields from the Question table. DO
not include the Employee primary key field, but DO include the corresponding
foreign key from the Question table. Once you enter the key, all of the
corresponding Employee fields will display on the form.

2. Use a combo box that includes all the Employee fields you wish to
display, and add textboxes to display them using the Column property of the
combo box(zero-based), e.g., to display the 2nd column, set the textbox's
Control Source to:

=YourComboBox.Column(1)

I can't figure out why you'd ever want to save these fields to the Question
table, when you can access them at any time via a query, and avoid
maintenance headaches by having more than one authoritative source of data,
but, since you asked, it would be done by adding textboxes bound to the
field's of interest, and assigning them via the combo box' AfterUpdate event:

Me![EmployeeField]=Me!YourComboBox.Column(x), where x is the column index.

Hope that helps.
Sprinks
 
sprinks, i have no idea what you're talking about.

i figured it out though. i just made a sub form

Sprinks said:
Rigas,

I suspect you mean display the information from the Employee table once you
have selected the Employee. If this is the case, you have two options:

1. Base your Question data input form on a query that includes the Employee
fields you wish to display, and all the fields from the Question table. DO
not include the Employee primary key field, but DO include the corresponding
foreign key from the Question table. Once you enter the key, all of the
corresponding Employee fields will display on the form.

2. Use a combo box that includes all the Employee fields you wish to
display, and add textboxes to display them using the Column property of the
combo box(zero-based), e.g., to display the 2nd column, set the textbox's
Control Source to:

=YourComboBox.Column(1)

I can't figure out why you'd ever want to save these fields to the Question
table, when you can access them at any time via a query, and avoid
maintenance headaches by having more than one authoritative source of data,
but, since you asked, it would be done by adding textboxes bound to the
field's of interest, and assigning them via the combo box' AfterUpdate event:

Me![EmployeeField]=Me!YourComboBox.Column(x), where x is the column index.

Hope that helps.
Sprinks

RigasMinho said:
thanks for your help but still ...
I really need to make so that I have one table with the Employee information
one table with question they asked but also populates the information of
employee automatically from the employee information table

how would i go about doign this?
 
Sorry we didn't connect, Rigas, but glad you solved your problem.

Sprinks

RigasMinho said:
sprinks, i have no idea what you're talking about.

i figured it out though. i just made a sub form

Sprinks said:
Rigas,

I suspect you mean display the information from the Employee table once you
have selected the Employee. If this is the case, you have two options:

1. Base your Question data input form on a query that includes the Employee
fields you wish to display, and all the fields from the Question table. DO
not include the Employee primary key field, but DO include the corresponding
foreign key from the Question table. Once you enter the key, all of the
corresponding Employee fields will display on the form.

2. Use a combo box that includes all the Employee fields you wish to
display, and add textboxes to display them using the Column property of the
combo box(zero-based), e.g., to display the 2nd column, set the textbox's
Control Source to:

=YourComboBox.Column(1)

I can't figure out why you'd ever want to save these fields to the Question
table, when you can access them at any time via a query, and avoid
maintenance headaches by having more than one authoritative source of data,
but, since you asked, it would be done by adding textboxes bound to the
field's of interest, and assigning them via the combo box' AfterUpdate event:

Me![EmployeeField]=Me!YourComboBox.Column(x), where x is the column index.

Hope that helps.
Sprinks

RigasMinho said:
thanks for your help but still ...
I really need to make so that I have one table with the Employee information
one table with question they asked but also populates the information of
employee automatically from the employee information table

how would i go about doign this?

:

Hi, Rigas.

When you find yourself trying to duplicate information from one table into
another, it should be a red flag that the design of your data is less than
optimal. In designing a relational database application, think in terms of
"things" (tables) that have "attributes" (fields)--e.g., People, Questions,
etc. Don't duplicate data from one table to another--the only field you need
to include is one corresponding to the related table's primary key--called a
foreign key (FK). The FK "unlocks" the related table, allowing you "Access"
to any of its fields.

For example, if you're storing data in Questions for a person stored in the
related table People, store ONLY the People's numeric primary key. You can
easily *display* the name fields by basing your data input form that includes
the fields from Questions and the name fields from People.

See a good reference on "database normalization".

Hope that helps.
Sprinks

:

I have two tables
Table1: has fields for Last name, First name, phone number
Table2: User last name, first name, question asked, and question answered

How would I go about making a form so it is able to call the information
from table1 then input that same information into table2?

For example:
Say i put in the name
John, Smith, 911-911-9111

When i goto forms i am able to pull up his information by making table1 a
record source. However I want to pull up John Smith and phone number then
also update thsi same record into table 2 and add more information on what
his question is.

Does this make sense?
 
Back
Top