Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / December 2006

Tip: Looking for answers? Try searching our database.

Modify a control value in an Access report through VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Anja - 06 Dec 2006 23:38 GMT
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
Allen Browne - 07 Dec 2006 02:07 GMT
Unlike forms where you can alter the value in a control any time, reports
format the data and lock it in as the records are fitted to the page, so you
cannot go back and change it later.

You can use the Format event of the section that contains the control to
programmatically assign a value.

But in this case, assuming Form1 is still open in the background, you could
just set the Control Source of your text box to:
   = "Here are the options for " & [Forms].[Form1].[Text2]

If you are opening the report via a button on your form (i.e. OpenReport)
and you are using Access 2002 or later, you can pass the description of the
filter in the OpenArgs. There's an example here:
   http://allenbrowne.com/AppPrintMgtCode.html#OpenTheReport
Ignore the block about "Set the printer for this report ..."

Signature

Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Hi everyone,
>
[quoted text clipped - 18 lines]
>
> Anja
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.