Using a variant for report field name

L

Laura

I'm setting report values with VB on the report activate
event. I'm using Reports!reportname!field = Variable,
I want to set the field name with a variant, I tried
Reports!reportname! " & varfield & " This didn't work,
any ideas.


Thanks
 
M

Marshall Barton

Laura said:
I'm setting report values with VB on the report activate
event. I'm using Reports!reportname!field = Variable,
I want to set the field name with a variant, I tried
Reports!reportname! " & varfield & " This didn't work,
any ideas.

Since you can set a field name this way, I assume you want
to reference a control or a field through a string type
variable. The syntax would then be:

Reports!reportname.Controls(varfield)

I'm not sure you can get away with using the Activate event
for this. Remember that Activate only fires when a report
is previewed, it is not fired when the report is printed.
Normally, you would use the Format event of the section
containing the control you want to set.
 

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