VBA Controlled fields on a report

  • Thread starter Thread starter David Findlay
  • Start date Start date
D

David Findlay

I'm trying to build a report where some fields are created on the fly
using some vba. I've tried using textboxes and labels, but I don't seem
to be able to modify either's values from vba code. How do I do this?
Thanks,

David
 
I'm trying to build a report where some fields are created on the fly
using some vba. I've tried using textboxes and labels, but I don't seem
to be able to modify either's values from vba code. How do I do this?
Thanks,

David

You haven't given enough information, so the best I can do is give a
generic answer.
Leave the text box unbound.
Then using VBA, Code the Detail Format or Print event (depends upon
what you are doing), something like:
Me![TextBoxName] = [FieldA] & " " & [FieldB]
or
Me![LabelName].Caption = "Whatever"

Adapt the above for whatever you need.
 
If you have an unbound text box named txtResult in the detail section of the
report, you can add code in the On Format event of the detail section like:

Me.txtResult = mvarMyMemoryVariable
 
Leave the text box unbound.
Then using VBA, Code the Detail Format or Print event (depends upon
what you are doing), something like:
Me![TextBoxName] = [FieldA] & " " & [FieldB]
or
Me![LabelName].Caption = "Whatever"

Adapt the above for whatever you need.

Thanks, that's what I was after. Thanks,

David
 
Back
Top