get response from command button

B

Bruce

Hi - I am trying to run a report with the function below. I wish to open the
form 'frm_Trade_Param' to select some query filters and then run the report.

Basically I wish to get a response from this form and continue my code as
follows;

cb_A is a command button. If this is pressed the report is run.
cb_B is also a command button. If this is pressed then the macro exits and
the form is closed.

I can do this from the form directly but I don't want to hard code this into
the form because I wish to reuse for other reports. Basically this is similar
to a vb yes/no response. How can I adjust my code to do this?

Bruce

Function rpt_Trades_Complete()
DoCmd.OpenForm "frm_Trade_Param", acNormal, "", "", , acNormal

If cb_A is pressed Then
DoCmd.OpenReport "rpt_Trades_Complete", acViewNormal, "", "", acNormal
ElseIf cb_B is pressed Then
DoCmd.Close acForm, "frm_Trade_Param"
End If
End Function
 

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