J
J_Goddard via AccessMonster.com
Hi All -
I am sure this is a case of overlooking the obvious. I am trying to adjust a
form's header when the report is generated to more accurately reflect the
report's content. Until now, I have never had a problem. The report is
opened from a form VB module with:
DoCmd.OpenReport "Diagram CORCAS Prtvar", acViewPreview
In the On Format event of the report header, I have this code (for debugging
purposes):
Debug.Print "List of controls"
Debug.Print "================"
Dim ctl As Control
For Each ctl In Me.Controls
Debug.Print ctl.Name, ctl.ControlType
Next
MsgBox "Current form/report is " & Me.Name
MsgBox "Stage number is " & Me![Stage Number]
The (edited) output from the For Each ctl loop looks like this:
List of controls
================
<<Snipped>>
dataset_id 109
Stage Number 109 << Note this one
kp1 109
kp2 109
<<snipped>>
and it get all the right control names and types.
MsgBox "Current form/report is " & Me.Name displays the correct name
However, this code line:
MsgBox "Stage number is " & Me![Stage Number] produces:
Error 2424, "The expression you entered has a field, control or property name
that PC-CODAP can't find"
This doesn't make sense - the debugging loop shows the [Stage Number] control
is there, so why can I not reference it? This problem applies to all the
other controls too - not just [stage number].
Any ideas??
Thanks
John
I am sure this is a case of overlooking the obvious. I am trying to adjust a
form's header when the report is generated to more accurately reflect the
report's content. Until now, I have never had a problem. The report is
opened from a form VB module with:
DoCmd.OpenReport "Diagram CORCAS Prtvar", acViewPreview
In the On Format event of the report header, I have this code (for debugging
purposes):
Debug.Print "List of controls"
Debug.Print "================"
Dim ctl As Control
For Each ctl In Me.Controls
Debug.Print ctl.Name, ctl.ControlType
Next
MsgBox "Current form/report is " & Me.Name
MsgBox "Stage number is " & Me![Stage Number]
The (edited) output from the For Each ctl loop looks like this:
List of controls
================
<<Snipped>>
dataset_id 109
Stage Number 109 << Note this one
kp1 109
kp2 109
<<snipped>>
and it get all the right control names and types.
MsgBox "Current form/report is " & Me.Name displays the correct name
However, this code line:
MsgBox "Stage number is " & Me![Stage Number] produces:
Error 2424, "The expression you entered has a field, control or property name
that PC-CODAP can't find"
This doesn't make sense - the debugging loop shows the [Stage Number] control
is there, so why can I not reference it? This problem applies to all the
other controls too - not just [stage number].
Any ideas??
Thanks
John