query a form?

C

Cristina

Hi everybody.

I am trying to build a relational database. This is a complicated task for
me... as I started using Access2003 only 2 weeks ago. I have created the
structure, no problems. Now I am trying to build a query on the entire
database. Is that possible? Otherwise, I have a form that contains all the
informations I want to query, is it possible to build a query on this form.
And if yes, how? The other option, the easiest I guess, would be to query the
central table of my database, hoping that Access will look in the related
tables for information. I did it, but something went wrong.

Hope someone can help.
Cheers,
 
B

Bob Miller

If you mean by "entire database" all the tables in the database, it i
possible to include all of them in one query.
You will base your forms (generally for data input) on tables and/o
queries.
As a simple example you might have a personnel table with:
FirstName, LastName, Address, City, Phone, etc. and an EmployeeID a
the primary key.
You can then create a table that has all Training courses employee
take with:
ClassName, Date, and EmployeeID.
Once you entered all the employee data you can enter training data fo
each employee in the same table needing only the EmployeeID for th
emplyoyee info.
You could then create a query:
SELECT Personnel.EmployeeID, Personnel.LastNAme, Personnel.FirstName
Personnel.Address, Personnel.City, Personnel.Phone, Courses.Course
Courses.Date
FROM Personnel INNER JOIN Courses ON Personnel.EmployeeID
Courses.EmployeeID;
This query will list a line for each course everyone took.
I hope this helps,
Bob
 
J

John Vinson

Hi everybody.

I am trying to build a relational database. This is a complicated task for
me... as I started using Access2003 only 2 weeks ago. I have created the
structure, no problems. Now I am trying to build a query on the entire
database. Is that possible?

Sometimes... but it's almost never the right way to go.
Otherwise, I have a form that contains all the
informations I want to query, is it possible to build a query on this form.

You have it backwards. A Form contains no data: it's just a tool, a
window. You'll typically base the Form on a Query, and once in a while
you'll reference a form control as a criterion in a query - but you
cannot base a Query on a Form.
And if yes, how? The other option, the easiest I guess, would be to query the
central table of my database, hoping that Access will look in the related
tables for information. I did it, but something went wrong.

The most common solution is to use the powerful Subform control. Base
your main form on the "one" side, "main" table; on that Form put one
or more Subforms bound to the "many" side tables.

Take a look at the Orders form in the Northwind sample database for an
example.

John W. Vinson[MVP]
 
C

Cristina

Thank you guys!
Cristina

Bob Miller said:
If you mean by "entire database" all the tables in the database, it is
possible to include all of them in one query.
You will base your forms (generally for data input) on tables and/or
queries.
As a simple example you might have a personnel table with:
FirstName, LastName, Address, City, Phone, etc. and an EmployeeID as
the primary key.
You can then create a table that has all Training courses employees
take with:
ClassName, Date, and EmployeeID.
Once you entered all the employee data you can enter training data for
each employee in the same table needing only the EmployeeID for the
emplyoyee info.
You could then create a query:
SELECT Personnel.EmployeeID, Personnel.LastNAme, Personnel.FirstName,
Personnel.Address, Personnel.City, Personnel.Phone, Courses.Course,
Courses.Date
FROM Personnel INNER JOIN Courses ON Personnel.EmployeeID =
Courses.EmployeeID;
This query will list a line for each course everyone took.
I hope this helps,
Bob
 
Top