open and filter report from command button in form

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

Guest

please help i have a form named "add and edit orders" and a report named
"purchase order"

In the form i have a field [OrderID] and in the report i have a field
[orders.OrderID]
where these 2 field are identicle.

i want to be able to click a command button to open the report and filter by
the [OrderID] field. i am assuming that i need to assign a maco to the
command buuton on click but no matter what i try when i set up the macro it
wont filter the report.

hope this makes sense

many thanks

dave
 
The command button wizard should be able to do this for you. If not, the
code is very simple. Just follow these instructions:

1. Open your form in Design View
2. Add a command button.
3. If the wizard doesn't work, just open a property sheet for the selected
button.
4. Click in the On Click property
5. Click the down arrow and choose [Event Procedure]
6. Click the elipses (...) button, a code window will open
7. Type the following line of code:

DoCmd.OpenReport "YourReportNameHere", acViewPreview,, "OrderID=" &
Me.OrderID

smile ... you have written VBA code.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

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

Back
Top