Query search criteria

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

Guest

I am trying to get a printout of an invoice and I’m having a lot of trouble
getting it to print the information I want. The information for each invoice
is on an order form which contains Name, Address, Order no etc. This form
contains a Subform with each product on it.
The subform gets it data from a query with the criteria set to Date(), so
that it only gets the order products from the current days date. This also
applies to the query I use for the data in the main form.
However, the subform query shows every record of every order from the
current day, so that in the printout, Order No 12, for example, prints all
the products that are in the query including those of Order No 13 ,14 etc as
does Order No 13, Order No 14 and so on.
How can I get the query for the subform to show only the products for the
current order number without having to physically type in the correct number
in the query criteria box?
 
Presumably you have two tables:
- an Invoice table that feeds your main form, with an InvoiceId primary key;
- an InvoiceDetail table that feeds your subform.
The InvoiceDetail table will have an InvoiceId field also, which tells which
invoice this row belongs to. If that is a new idea, open the Northwind
sample database, and see how the Order and OrderDetail tables work.

Once you have the form and subform working correctly, you can use the
InvoiceId in the main form to print out the invoice laid out as desired as a
report. Details in article:
Print the record in the form
at:
http://allenbrowne.com/casu-15.html
 
Back
Top