My macro does not recognize the ListBox (lstBox) that resides on a Form (frmMktSgmt)
I tried the following two codes with two different error messages:
CODE 1:
Dim lstBox as ListBox
DoCmd.OpenForm "frmMktSgmt", acNormal
Set lstBox = Forms("frmMktSgmt"
("lstMktSgmts"
'Form opens in normal view but I get the following error on the "Set lstBox = . . ." line:
"Method 'Item' of Object 'Forms' Failed"
CODE2:
DoCmd.OpenForm "frmMktSgmtSelect", acDesign
Set lstBox = Forms("frmMktSgmt"
("lstMktSgmts"
DoCmd.OpenForm "frmMktSgmt", acNormal
NumList = lstBox.ListCount
'Form opens in Design view and the Set lstBox line seems to work. But when I open the Form in Normal view so I can act on the ListBox, the "lstBox" properties appear to vanish. I get the following error on the "NumList = ..." line:
"The expression you entered refers to an object that is closed or doesn't exist".
Any help with fixing one of the above errors would be greatly appreciated.
Jim
I tried the following two codes with two different error messages:
CODE 1:
Dim lstBox as ListBox
DoCmd.OpenForm "frmMktSgmt", acNormal
Set lstBox = Forms("frmMktSgmt"
'Form opens in normal view but I get the following error on the "Set lstBox = . . ." line:
"Method 'Item' of Object 'Forms' Failed"
CODE2:
DoCmd.OpenForm "frmMktSgmtSelect", acDesign
Set lstBox = Forms("frmMktSgmt"
DoCmd.OpenForm "frmMktSgmt", acNormal
NumList = lstBox.ListCount
'Form opens in Design view and the Set lstBox line seems to work. But when I open the Form in Normal view so I can act on the ListBox, the "lstBox" properties appear to vanish. I get the following error on the "NumList = ..." line:
"The expression you entered refers to an object that is closed or doesn't exist".
Any help with fixing one of the above errors would be greatly appreciated.
Jim