View Full Version : Include Variable Data from Input Box to Report Header


Graham T
03-24-2002, 08:45 AM
I have created a report that is based on a questionaire filled in on a form.

The results of the form can then be printed out and I would like to include an input box to ask for the users name to be included in an unbound text box, based in the report header.

Can anyone please help with the code that is required to perform this and place the variable data into the report.

I would imagine that this would be added to the On Open event of the report.

TIA

Graham

Lyn Mac
03-25-2002, 06:29 PM
Graham,

In an unbound textbox in the report header in design veiw try:

=Forms!FormName!UserNameControl

Catch:

The form must be open for the report to get the UserName.

HTH,

Lyn

Graham T
03-26-2002, 04:00 AM
Thanks Lyn

I figured this out by using the following attached to the On Open event of the report:


Private Sub Report_Open(Cancel As Integer)

'Creates an input box asking for the user's name and maximises report
Me.Label35.Properties("Caption") = InputBox("Please type your name", "Name")

End Sub