If the tag property of the button is not being used, assign the variable to
it and have the textbox on the report reference the form control in it's
OnLoad event.
Example: In Button Code
Me!Button.Tag = Var
In Report OnOpen (Maybe OnLoad) Event
Me!TextFromButton = Forms!FormName!Button.Tag)
Of course the form will need to remain open until the report is finished
opening.
Mike Storr
www.veraccess.com
"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
sc******@cf.ac.uk (Thierry Schmitt) wrote in message
news:<42**************************@posting.google. com>...
Hello all,
I m quite sure that s a common problem and even that the answer to it
has been given somewhere, forgive my lack of perspicacity but here is
my problem:
In the vba code of a button on a form, leading to the preview of a
report, I ve got a variable (string) which has been filled with some
information from a SQL querry. I want to export this variable to the
report to be previewed.
The report has been built before with the assistant and the button on
the form has a command looking like DoCmd.Open "form"....
What would be the best way then to add a textbox or a label on the
report with the string resulting from the SQL querry?
What I ve been trying to do so far is to add a textbox on the report
and add in vba code something like
Reports!Invoice_Report.TextBoxAdress= var, but even if the debugger
doesnt complain, the textbox is empty (even though I m sure I ve got
the good value in var).
Any hints or pointer to a web page would be appreciated.
What if you create a wrapper function that assigns the resulting
variable to the function name, and then put that on your report?