Using a variant for report field name

  • Thread starter Thread starter Laura
  • Start date Start date
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
 
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.
 
Back
Top