General discussion

Locked

Access-Pass value from form to report

By skennedy10 ·
I am a just above "novice" status, but I do know some VB code. I just have never used Access and VB together and VB is rusty!

I need to take the value of the current record's OrderID and pull the report for only that OrderID. I want to do so bydeclaring a global variable and then pulling that variable into the report.

I would appreciate someone just copying a bit of code they have used for an example--including
1. code on the original form (what DIM statements, etc, and how to send that variable to the global,
2. the global code and, I guess, public procedure, and
3. the Report (or form--should not matter)code which brings the code into the report.

I have some that work with forms![frmSales]![OrderID] = Me![OrderID]

but others won't work even when both forms are left open.

Thanks!

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Access-Pass value from form to report

by RichTee In reply to Access-Pass value from fo ...

A very simple way to run a report using the ?current record?s OrderID? from a form as the parameter for the report is to create an intermediary query and then have the report use this query as its control source.

The query (containing all the fields you need for the report) would have the value of the ?current record OrderID? from the report as its parameter.

A generic example of the parameter for the criteria for this field in the query would be: [Forms]![Form1]![Text0]

Just replace the name of the form and the control that your are referencing in the example.

Good Luck.

Rich

Collapse -

Access-Pass value from form to report

by skennedy10 In reply to Access-Pass value from fo ...
Collapse -

Access-Pass value from form to report

by skennedy10 In reply to Access-Pass value from fo ...

Thanks. This method I figured out, also, from the examples I had (I am repairing a db created by someone else). I understand it better now, though.

I still would like an example of creating a global variable in code which works or ischanged from multiple forms.

This is getting me through this project, though, so thanks.
Susan

Collapse -

Access-Pass value from form to report

by skennedy10 In reply to Access-Pass value from fo ...

This question was closed by the author

Back to Software Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums