A
azu_daioh
I have a report with over 300 unbound text box with the following
control source:
=DCount("[EntryDate]","[ID Flag Imported]","[FO_ID]=1 And
Year([EntryDate])=[GetYear] And Month([EntryDate])=4")
Now I need to change [ID Flag Imported] to [ID Flag]
Is there an easier way to change all the unbound text boxes control
source without doing it one at a time? I tried one of the codes I
found here but I couldnt get it to work
-----------------
Dim ctl As Control, strReportName As String
strReportName = "rptReportName"
DoCmd.OpenReport strReportName,acViewDesign,,,acHidden
For Each ctl In Reports(strReportName).Controls
If InStr(ctl.ControlSource, "Forms!Form1") > 0 Then
ctl.ControlSource = Replace(ctl.ControlSource, "Forms!Form1",
"Forms!Form2")
End If
Next
DoCmd.Close acReport, strReportName, acSaveYes
---------------------
The name of my report is "Monthly ID Flag count by FO"
so I replaced "rptReportName" by "Monthly ID Flag count by FO"
replaced "Forms!Form1" with "[ID Flag Imported]"
replaced "Forms!Form2" with "[ID Flag]"
and I pasted the code after I clicked the "code" tool from the report
design view
Please help. I have 2 reports I need to replace the control source and
the other is another 300+ text boxes.
Thank you,
Sharon
control source:
=DCount("[EntryDate]","[ID Flag Imported]","[FO_ID]=1 And
Year([EntryDate])=[GetYear] And Month([EntryDate])=4")
Now I need to change [ID Flag Imported] to [ID Flag]
Is there an easier way to change all the unbound text boxes control
source without doing it one at a time? I tried one of the codes I
found here but I couldnt get it to work
-----------------
Dim ctl As Control, strReportName As String
strReportName = "rptReportName"
DoCmd.OpenReport strReportName,acViewDesign,,,acHidden
For Each ctl In Reports(strReportName).Controls
If InStr(ctl.ControlSource, "Forms!Form1") > 0 Then
ctl.ControlSource = Replace(ctl.ControlSource, "Forms!Form1",
"Forms!Form2")
End If
Next
DoCmd.Close acReport, strReportName, acSaveYes
---------------------
The name of my report is "Monthly ID Flag count by FO"
so I replaced "rptReportName" by "Monthly ID Flag count by FO"
replaced "Forms!Form1" with "[ID Flag Imported]"
replaced "Forms!Form2" with "[ID Flag]"
and I pasted the code after I clicked the "code" tool from the report
design view
Please help. I have 2 reports I need to replace the control source and
the other is another 300+ text boxes.
Thank you,
Sharon