Query Criteria a List Box Record

ASherbuck

Registered User.
Local time
Today, 12:02
Joined
Feb 25, 2008
Messages
194
Hello Daily Post, I suppose,

Here is what I've got:

On one form resides a list box that get's it's results based on a customers sales history.

The form contains all the customers prudent information, otherwise.

What I'm attempting is such:

Onclick for the listbox is DoCmd.OpenReport "RptIndividualSale" the source for the report is a query whose criteria is the unique SaleID [Forms]![Main]![LstSales].[SaleID] for the records in the list box.
It also has a few other fields such as the item name, sale amount, etc.

My hitch is that it is using every SaleID as a result in the report. What I wish to attain is a report that only generates the information for that single sale, instead of the entire history.

So if the list had SaleIDs of
1
2
3
4
5

and a user clicked 5 a report would open showing ONLY the details of the Sale with ID 5, as stated it currently shows details for all the SaleIDs, so I have a report with 1, 2, 3, 4, 5.

Any way to fix this?
 
Last edited:
try puttting it in the after update event of the list box

you could also try putting the filter in the docmd line, rather than in the query

DoCmd.OpenReport "RptIndividualSale",,,"masterid = " & [saleid] instead to filter the records (not sure how many commas - the parameter you need is filter form criteria)
 

Users who are viewing this thread

Back
Top Bottom