Modify a control value in an Access report through VBA

A

Anja

Hi everyone,

I have been trying this for an hour now but have not been able to make
this work!

So, I have an Access report (actually all it has is a header so far).
What I want to do is modify the header based on the selection the user
has made on a form.

So, if the user chooses 'Anja'. The header should say 'Here are the
options for Anja'.

So, I have a Text Box on th form and I am trying to set the value of
the text box through VBA

So, if my report is called TestReport and the text box is called
NameBox, how can I set the value in the text box and then open the
report???

Please help me!

Anja
 
D

Damian S

Hi Anja,

Stop trying to set it through VBA - there is a much simpler way. Simply use
the following as the control source of your text box on your report:

="Here are the options for " & forms!FORMNAME.TEXTBOX

Where FORMNAME is the name of the form and TEXTBOX is the name of the text
box where you have typed the value.

Hope this helps.

Damian.
 
R

Raptor

Damian said:
Hi Anja,

Stop trying to set it through VBA - there is a much simpler way. Simply use
the following as the control source of your text box on your report:

="Here are the options for " & forms!FORMNAME.TEXTBOX

Where FORMNAME is the name of the form and TEXTBOX is the name of the text
box where you have typed the value.

Hope this helps.

Damian.

Don't know if it helped them but it sure helped me out.
I was going about it the hard way since I am more familiar with coding
things that designers.
Adding the reference in through the designer saved me a ton of work.
Wouldn't have thought to do it if it wasn't for your post.
 

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