Replace parameter values in control source property

theSizz

Registered User.
Local time
Today, 16:35
Joined
Nov 29, 2002
Messages
34
I have a text box in a report, with it's control source property set to =[BegDt].
Upon loading the report a message box pops up and asks the user for the value of [begDt]. This occurs 3 more times for 3 other parameters.

Now I want to change the design of the report so I decided to put these 4 parameters on a form so the user can fill in the 4 values all at once rather than responding to 4 message boxes that pop up when you run the report.

The problem is now the control source properties in all the different text boxes need to be changed to [forms]![frmABC]![txtBegDt] etc.etc. There are over 100 text boxes in this report that make reference to the 4 different parameters.
Is there a replace command I can use to change all the occurrences in the text boxes or perhaps a simpler way would be to pass the values to the report through code.

I tried placing this in the report header's format event and it doesn't seem to have any effect.

Code:
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)

begytd = [Forms]![frmABC]![txtStDt]
endytd = [Forms]![frmABC]![txtEndDt]
curmo = [Forms]![frmABC]![cboMo]
curyr = [Forms]![frmABC]![cboYr]

End Sub

I should mention that the report uses a table (tblRecap) as it's record source. I tried using a query that refers back to the form for the parameter values but that means I have to use the query as the reports record source and that creates a problem because the report needs fields from the table to perform calculations.

Can someone help me with a solution please.

Thanks for your time.
 
The easiest way is to select the controls that you wish change the control source proporty and type the values that u want in the properties window. They will all change at once..But I still wonder why u have those so many controls that u need to fill...any way, that's the easiest in my opinion.
 

Users who are viewing this thread

Back
Top Bottom