D
DinosRose
I'm attempting to refactor some of my existing code, and I've run into a bit
of a snag.
In my current code, I'm setting a variable for Form to set controls on the
form I am opening to the value of controls on the
Forms!parentForm!subForm.form in use. In my code gintAuditForm is a global
variable which holds a value represting which "Audit Form" is currently in
use.
Dim subfrm As Form
Select Case gintAuditForm
Case 1
Set subfrm = [Forms]![Audit Form]![audit subform].[Form]
Case 2
Set subfrm = [Forms]![Audit Form Stage2]![audit subform stage2].[Form]
..
..
..
End Select
Me.txtALFirsttNm = subfrm![txtFirstNm]
....
I've built a reference table that lists the parentForm and the subForm
represented by the 7 different gintAuditForm values. I want to eliminate use
of the select case by assigning parentForm and subForm to variables and using
that to set the Form variable.
However, the following code doesn't work:
frmName = DLookup("parentForm", "zzzAuditFormRefTbl", "FormValue=" &
gintAuditForm)
subfrmName = DLookup("subForm", "zzzAuditFormRefTbl", "FormValue=" &
gintAuditForm)
Set subfrm = [Forms]![" & frmName & "]![" & subfrmName & "].[Form]
Any ideas?
of a snag.
In my current code, I'm setting a variable for Form to set controls on the
form I am opening to the value of controls on the
Forms!parentForm!subForm.form in use. In my code gintAuditForm is a global
variable which holds a value represting which "Audit Form" is currently in
use.
Dim subfrm As Form
Select Case gintAuditForm
Case 1
Set subfrm = [Forms]![Audit Form]![audit subform].[Form]
Case 2
Set subfrm = [Forms]![Audit Form Stage2]![audit subform stage2].[Form]
..
..
..
End Select
Me.txtALFirsttNm = subfrm![txtFirstNm]
....
I've built a reference table that lists the parentForm and the subForm
represented by the 7 different gintAuditForm values. I want to eliminate use
of the select case by assigning parentForm and subForm to variables and using
that to set the Form variable.
However, the following code doesn't work:
frmName = DLookup("parentForm", "zzzAuditFormRefTbl", "FormValue=" &
gintAuditForm)
subfrmName = DLookup("subForm", "zzzAuditFormRefTbl", "FormValue=" &
gintAuditForm)
Set subfrm = [Forms]![" & frmName & "]![" & subfrmName & "].[Form]
Any ideas?