K
KRice
This is a very strange issue, but I'll try to be clear. I have a main form
with two separate subforms. (The subforms are not nested.) Each subform is
in datasheet view because it should look like spreadsheet data. The main
form is in standard form view.
On each subform, there is a few fields that get totaled. I want to
reference this value on the main form. Each subform is based on a filtered
version of the same table, while the main form has no record source. To
avoid showing mathematical errors, I check each subform to make sure there's
at least one record. If there are no records, the control on the main form
shows "0". Otherwise, it shows the value pulled from the subform. The code
is in the control source on the main form, and it looks like this:
=IIf(Forms("f_Reports_Main")![SubFormName].[Form].[Recordset].[RecordCount]=0,0,SubFormName!FieldName)
In Access 2003, with the Macro Security set to "Low", this works fine.
However, if I up the security setting to "Medium" (which is the default in
Access 2003), then the same code returns "#Error" in the textbox on the main
form.
On the subform, the value is still calculating correctly, so this leads me
to two possible conclusions:
1) This is a bizarre bug in Access 2003 in how it utilizes security, or
2) There is another way to access the value on the Subform that I'm not
aware of. (Remember that I need to make a record count check first.)
Does anyone have any insight on this? I don't know why changing the
security setting from Low to Medium would alter the functionality of the
code, especially since it's utilizing no outside data and really, it's just
pulling a value from a subform to display on a form.
Any input on this would be appreciated. And, for the record, I can't change
the security settings at work, so I can't just "fix" it by setting the
security to "Low".
~Kevin
with two separate subforms. (The subforms are not nested.) Each subform is
in datasheet view because it should look like spreadsheet data. The main
form is in standard form view.
On each subform, there is a few fields that get totaled. I want to
reference this value on the main form. Each subform is based on a filtered
version of the same table, while the main form has no record source. To
avoid showing mathematical errors, I check each subform to make sure there's
at least one record. If there are no records, the control on the main form
shows "0". Otherwise, it shows the value pulled from the subform. The code
is in the control source on the main form, and it looks like this:
=IIf(Forms("f_Reports_Main")![SubFormName].[Form].[Recordset].[RecordCount]=0,0,SubFormName!FieldName)
In Access 2003, with the Macro Security set to "Low", this works fine.
However, if I up the security setting to "Medium" (which is the default in
Access 2003), then the same code returns "#Error" in the textbox on the main
form.
On the subform, the value is still calculating correctly, so this leads me
to two possible conclusions:
1) This is a bizarre bug in Access 2003 in how it utilizes security, or
2) There is another way to access the value on the Subform that I'm not
aware of. (Remember that I need to make a record count check first.)
Does anyone have any insight on this? I don't know why changing the
security setting from Low to Medium would alter the functionality of the
code, especially since it's utilizing no outside data and really, it's just
pulling a value from a subform to display on a form.
Any input on this would be appreciated. And, for the record, I can't change
the security settings at work, so I can't just "fix" it by setting the
security to "Low".
~Kevin