Setting a value of a text field on a report

B

bsc gmcc

I want to pass a string to a Microsoft Access Report and display the value of
it in the Group Header. I have a function that already opens the report using
a where clause and openargs. I would like to take the value of the argument
and set the value of a textbox in the group header. Can someone tell me if
and how I could do this? Thanks.

bscgmcc
 
K

Klatuu

You can reference objects and properties of your form from the report. Say
you want to incldue the report date that is on your form:
=forms!MyForm!txtReportDate
 
B

bsc gmcc

What I have is a form that users can select entries from combo boxes. I have
a button for the user to click to open the report. The button's OnClick event
calls a procedure that sets variables to the values of the combo boxes and
calls the report passing the string variables as a where clause. Can I use
those variables on the report? The function with the variables are in a
module1.
 
K

Klatuu

That would probably not work. There are a couple of ways you could do that.
One would be to create properties for your form that you could reference from
the report. Another would be to split the work between the form and the
report. Do what is necessary to create the Where clause in the form, then in
the report's open event, call the function(s) that will return the varialbes
you need for the report.
 
B

bsc gmcc

That worked. I was putting this in the Open event for the form but it was
giving me an error that I couldn't set the value of the textbox. So, I did
what you said below and it worked fine. I am not sure why. Thanks very much
for the help.
 
Top