Question : Configuring a report to open the selected record only

I have a MS Access 2007 database and it is currently in data entry mode.  I have a button configured for a this form which allows me to send a report on the selected incident.  The only issue I have this is I do not know how to get it to send the selected record and not the entire database.  I did advert this by adding date() into my querie however it will come up with every record that was created on that day.  

I would like the report to print out the selected record and nothing more.

Thanks,
Steve

Answer : Configuring a report to open the selected record only

When you use the open report method in the button code, you can use either the 3rd argument, which is the filter argument (the name of a query) or the 4th argument, which is an SQL WHERE clause without the word WHERE.  So it might look something like this:

DoCmd.OpenReport "Sales Report", acViewNormal, ,"[SalesRepID] = " & me.txtSalesRep

 which opens the report and restricts the data to field SalesRepID being equal to the value of a form control.

JimD.

Random Solutions  
 
programming4us programming4us