Set contolsource dynamically with concatenation

  • Thread starter Thread starter Terri
  • Start date Start date
T

Terri

I'm setting the control source of a report control dynamically from a form
control on the reports OnOpen event.

Me.TextB.ControlSource = "=Forms!frmreporting!TextB"

I want to add an asterisk to the value returned on the report so that if
Forms!frmreporting!TextB = "ABC" the field on the report would return *ABC.

How can I do this? I'm having problems with the syntax, probably the quotes.

Thanks.
 
I'm setting the control source of a report
control dynamically from a form
control on the reports OnOpen event.

Me.TextB.ControlSource = "=Forms!frmreporting!TextB"

I want to add an asterisk to the value returned on the report so that if
Forms!frmreporting!TextB = "ABC" the field on the report would return *ABC.

How can I do this? I'm having problems with
the syntax, probably the quotes.

My guess is that you are having trouble because the Controls aren't
available in the Open Event.

If you have only a few choices, pass the name in the OpenArgs (if you are
using Access 2002 or 2003), include each of the actual field sources as text
boxes with their visible property set to No, and an unbound control into
which to set the value for display.

Then in the Print event of the detail section, put code similar to this:

Me.txtText = "*" & Me("txt" & Me.OpenArgs)

where you replace "txtText" with the name of your unbound control, and name
your invisible controls with "txt" and the name you are passing in OpenArgs.

Larry Linson
Microsoft Access MVP
 

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

Back
Top