Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

queries

ResolvedVersion 2003

Dan has attended:
Access Introduction course

Queries

How can a formula be incorporated into a query for instance to link a unit quantity of sales to the unit price to come up with transaction value if the unit price is in the product table and the sales quantity is in a transaction table?

Edited on Mon 7 Apr 2008, 17:13

RE: Queries

Hi Dan, Thanks for the post, welcome to the forum, the answer to your question lies in relationships, when a table is created in Access it must be focused on its unique key, (eg everything in the table relates to the ID field), if this is the case and we create all our tables with this primary rule in mind then we can utilise Access as it is supposed to be; a Multi Relational Database, this means that tables are joined (or relationships are created through their primary keys); for example in its simplest form using the most common of relationships, a one to many join, one department has many employees, or one product can be ordered many times, (lots of packs of strawberries, each order for different number of packs) so when we create a query to show which employees are in which department Access will look for those employees who display a particular department ID and show them together. In the same way when we create a calculated field which extracts information from two different tables, (Products and Orders,) because they are linked, the query will calculate the values from each table using the joining fields to access the information. So in your example the query would be something like this: --- Transaction Value:[Product.Unit_Price]*[Transaction.Sales_Quantity] and so long as there is a link between the two tables (in the Transaction table the Product ID is shown as having been the item sold) then Access will extract the information and display the correct values. I hope that has helped, if so, please click the Resolved link, best regards Pete

Access tip:

Creating Parameter wildcard queries

To creat a parameter query that also uses a wildcard, in the query design type in like []+*.

View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.