D
Dick Minter
My form consists of a main form and two linked, embedded subforms. The main
form source is the employee master, the first subform ("emply_bal_subform")
source is a by-year summary of allowed absences (vacation, etc), and the
second subform shows current year absences. I've placed calculated text
boxes on subform 1 to show summary activity for the current year and balance
of unused allowances by category. The problem:
The dsum funciton entered as a record source on subform 1 returns only a
"Name?" error. The exact same expression placed on a command button on the
main form works as intended. The expression as entered:
= DSum("[hours]", "absences", "[reasonCode] = 2 AND [Year] = " &
Emply_bal_Subform.Controls![Year] & " AND [emp_id] = " &
Forms!fmEmpAbsHdr.Controls!Emp_ID)
The addition of some modifiers in the expression may be unnecessary but I
was trying everything starting with the usual "me" reference, and, as
indicated, this does work when called from a command button on the form.
I've also tested the string returned by the WHERE portion of the expression.
Why doesn't it work on the subform control? Can you suggest another approach?
DM
form source is the employee master, the first subform ("emply_bal_subform")
source is a by-year summary of allowed absences (vacation, etc), and the
second subform shows current year absences. I've placed calculated text
boxes on subform 1 to show summary activity for the current year and balance
of unused allowances by category. The problem:
The dsum funciton entered as a record source on subform 1 returns only a
"Name?" error. The exact same expression placed on a command button on the
main form works as intended. The expression as entered:
= DSum("[hours]", "absences", "[reasonCode] = 2 AND [Year] = " &
Emply_bal_Subform.Controls![Year] & " AND [emp_id] = " &
Forms!fmEmpAbsHdr.Controls!Emp_ID)
The addition of some modifiers in the expression may be unnecessary but I
was trying everything starting with the usual "me" reference, and, as
indicated, this does work when called from a command button on the form.
I've also tested the string returned by the WHERE portion of the expression.
Why doesn't it work on the subform control? Can you suggest another approach?
DM