Build a query

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

Guest

Please bear with me - I just purchased Access yesterday! I'm also not sure I
can explain exactly what I'm trying to do. Here goes -

I'm trying to create a form based on 2 tables. The first is the main table.
The second table is a simple 2-column table in which the first is actually a
heading that I would like to use for a "list." The other column contains a
"template" that I would like to insert into the field when the corresponding
heading is selected. Does that make sense? I didn't want to bore you with
the details, but it may help. This particular field is for a "source
citation". It would help if it could include a template for various types of
sources. I, therefore, created a table in which the first column would be
for instance, "encyclopedia", the second column is a template for citing an
encyclopedia as a source. How do I build a query that would allow the
selection of an item from column 1 and would then insert the corresponding
template from column 2?

Any help would be greatly appreciated!
 
Hi,


Make a query, bring the two tables, join them through their common
field. Drag and drop the field from one table over the matching field in the
second table. In the grid, bring all the fields you would need. Observe,
in data view, that if you fill the "heading" field in the first table, then,
by automatic lookup, the "template" field of the second table is
automatically selected. Save the query. Build the form using that query,
rather than the initial tables.


Hoping it may help,
Vanderghast, Access MVP
 
I appreciate your help, but I'm afraid I'm too new at this "query" stuff to
understand. I know what you mean by joining the two tables. If I have a
form with many fields from one table, and then a second table with two
columns - the items in column one to appear in a "list" that when selected
would automatically look up the data in column 2 and enter that data in the
field - would I join the field name from the first table with column 2 in the
second table. In other words would the join be between the field name and
the data that I ultimately want to appear there (column 2) or would it join
with the items I wish to appear in the "list" (column 1)? Once I create the
join and drop the required fields into the query grid - which I'm assuming
would the one field from table 1 and both fields from table 2 - what would
the criteria wording be that would create the automatic lookup? I know so
little that these might not even be the correct questions! For all I know,
what I'm trying to do isn't even possible. Actually, I'm not sure whether
I'm frustrated or just enjoying the thrill of learning a new program.

Thanks!
Claire
 
Hi,



Open Northwind. Make a new query, bring tables Products and Suppliers.
The fields SupplierID should be automatically joined. In the grid, drag the
* from each table, so the SQL statement should be like:

SELECT Products.*, Suppliers.*
FROM Suppliers INNER JOIN Products ON Suppliers.SupplierID =
Products.SupplierID;


Next, in data view, add a new record: Select a Supplier, from Products,
change of field (not of record) and the fields from Suppliers are
automatically supplied, in accordance, showing the automatic lookup in
action.



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top