aldeano
aldeano

Reputation: 601

Fill report with VBA

I got a form associated with a report. Depending on the fields filled in the form the report has to add some extra things, ej.: if the user chooses "A" in some field, let's say [options] field of the form, the report has to show "you choose A this time" in the [options] report's field, and "it's a good choice" in other field in the report, let's say [explanation] field.

I've used the openreport method in vba and playing around with the where statement or the openargs

docmd.openreport "myreport", acViewPreview, , "[options] = " & "you choose " + [forms!].[options!] + " this time"

But i don't need to do a query to fill the report, so the where condition doesn't fit my need. Also with openargs nothing happens, maybe i'm getting something wrong.. Does someone has an idea of how to make it work with openargs or with another method?

Upvotes: 0

Views: 777

Answers (1)

PowerUser
PowerUser

Reputation: 11801

There may be a simpler solution, but you can insert your user's choices into a 1 row table. Then use that table as a recordsource for your report.

An advantage of this approach is that, since your report will have a stable data source (table), it's a little easier to develop.

Upvotes: 1

Related Questions