2 Tables in one form?

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

Guest

Lets say I designed two tables one called "Cities" and One called "States"
Then I created a form and for simplicity's sake all I wanted to show was a
text box for "City" data and a text box for "State" data. At this point I am
not asking about relationships for tables or queries.

Is there coding which will let me call up data from two different table and
put it on the same form?

I am pretty new at databases, so any basic help is appreciated.

Seems like I can only associate one table at a time with a form. I can
create a query which lists data from both tables dumped int the query, but is
seems like I might be missing something pretty basic...
 
Hi Mark -- Unfortunately, to answer the question we have to talk about
relationships. You need a connection between your tables which is
accomplished by the way of a Primary Key (PK) and a Foreign Key (FK). In
your Cities table you need a field that can relate to the States table: for
grins, let's call it StateID.

In the Relationships window, you establish the relationship between the two
tables: goto Tools --> Relationships. The tables will be tied by the PK in
the States table and FK in the Cities table.

With this relationship established, you can use a query or forms/subforms,
or forms and combo/list boxes, etc to display the data you want.
 
Thanks for the reply! Lets complicate it even further. What if I added a
table for "Zip" What would the relationship look like then?
 
Thanks for the reply! Lets complicate it even further. What if I added a
table for "Zip" What would the relationship look like then?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top