From VBA, you can access a control on an open form with the syntax:
Forms!FormName!ControlName, so, basically, you can, in the procedure
handling the Report Open event, you can check the controls of the form, and
turn on or off the visibility of some controls in the report, as example:
Private Sub Report_Open(Cancel As Integer)
If Forms!formOne!ShowLabel6.Value <> "OK" Then Me.Label6.Visible = False
End Sub
So, basically, it is (easier if it is) the report which does the
synchronization, not the form.
Note that you can write additional code, in the report, to check if the form
is actually open (and if not, bypass the code about it).
Vanderghast, Access MVP
"Melissa" <(E-Mail Removed)> wrote in message
news:32C2469C-1D20-48F9-93E9-(E-Mail Removed)...
> I'm wondering if it is possible to change the contents of an unbound text
> box
> in a Report by using VBA language from a Form.
>
> Here's what I'm trying to do: When the user clicks on an Open Report
> button, I would like the user to be able to choose if certain text is
> displayed on the report or not. Then the Report should open. The certain
> text I'm referring to is only saved in the VB code I've used in the Form
> that
> he Open Report button is on. I can send code or give specifics if
> necessary,
> but I was hoping that there was a simple solution that I was overlooking.
> --
> Thanks, and as always, I greatly appreciate all the support on this site.
> Couldn't have done it without all your help.
|