Limit query output with criteria

G

Guest

I have a form based on a select criteria, and would like to limit the amount
of data available to the form. The query returns multiple records, and I
need to limit the number returned based on the output of one of the fields, a
Ship To Address. I need to pass only those records that have the same ship
to address to the form. This is used to create invoices, and this particular
client of mine generates a new invoice for each ship to address. (IE: Job
Site, Customer Shop, Customer Pickup, etc.) I would like to filter these
records in the query itself before opening the form. Any and all assistance
and suggestions are greatly appreciated!! Thanks in advance-Craig Z
 
P

pietlinden

Craig said:
I have a form based on a select criteria, and would like to limit the amount
of data available to the form. The query returns multiple records, and I
need to limit the number returned based on the output of one of the fields, a
Ship To Address. I need to pass only those records that have the same ship
to address to the form. This is used to create invoices, and this particular
client of mine generates a new invoice for each ship to address. (IE: Job
Site, Customer Shop, Customer Pickup, etc.) I would like to filter these
records in the query itself before opening the form. Any and all assistance
and suggestions are greatly appreciated!! Thanks in advance-Craig Z

if you look at the OpenForm method, you can pass a filter to it.

straight outta NWind...

Sub AddProducts_Click()
' This code created in part by Command Button Wizard.
On Error GoTo Err_AddProducts_Click

Dim strDocName As String

strDocName = "Products"
' Open Products form in data entry mode and store SupplierID in
' the form's OpenArgs property.
DoCmd.OpenForm strDocName, , , , acAdd, , Me!SupplierID

the openargs property acts as a filter, so only matching records are
shown.
 

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

Top