L
LarryP
I have a form where users select various actions. If they select option 1
(from an option group), a popup form with a combo box is supposed to open
where the user picks a value. The After Update event of the popup is
supposed to store that value in a global variable, then close itself. When I
run this process, though, my code errors out on the line FOLLOWING the
OpenForm because the global variable is still zero. (True, because although
the popup has opened, I haven't yet selected a value, buy why doesn't my code
wait for the popup to finish doing its thing before worrying about the next
line?
Here's the code, with the error-throwing line preceded by several asterisks;
the culprit in that line is intBatchPromoteGateNo, which is still zero
because the popup hasn't yet done its work. How can I force the popup
actions to run to completion BEFORE my code moves on?
Case 1:
DoCmd.OpenForm "frmBatchPromotePopup"
'Previous line opens custom input box; user selects contract, number
loads to global variable, popup closes
*****strBatchPromoteGateName = DLookup("[GateName]", "tblGates",
"[GateNo] = " & intBatchPromoteGateNo)
intBatchPromoteMinCurrentGate = DMin("[CurrentActiveGate]",
"tblContractLIData", "[ContractNo] = '" & _
Forms!frmTrackingMain!ContractNo & "' And [BatchFlag] = True")
If intBatchPromoteMinCurrentGate < intBatchPromoteGateNo - 1 Then
MsgBox ("WARNING: One or more of the flagged items has not yet
completed all the gates prior to " & _
strBatchPromoteGateName & _
". If you proceed with this batch action, any Line Items in that
category will bypass the intervening, uncompleted gates.")
End If
(from an option group), a popup form with a combo box is supposed to open
where the user picks a value. The After Update event of the popup is
supposed to store that value in a global variable, then close itself. When I
run this process, though, my code errors out on the line FOLLOWING the
OpenForm because the global variable is still zero. (True, because although
the popup has opened, I haven't yet selected a value, buy why doesn't my code
wait for the popup to finish doing its thing before worrying about the next
line?
Here's the code, with the error-throwing line preceded by several asterisks;
the culprit in that line is intBatchPromoteGateNo, which is still zero
because the popup hasn't yet done its work. How can I force the popup
actions to run to completion BEFORE my code moves on?
Case 1:
DoCmd.OpenForm "frmBatchPromotePopup"
'Previous line opens custom input box; user selects contract, number
loads to global variable, popup closes
*****strBatchPromoteGateName = DLookup("[GateName]", "tblGates",
"[GateNo] = " & intBatchPromoteGateNo)
intBatchPromoteMinCurrentGate = DMin("[CurrentActiveGate]",
"tblContractLIData", "[ContractNo] = '" & _
Forms!frmTrackingMain!ContractNo & "' And [BatchFlag] = True")
If intBatchPromoteMinCurrentGate < intBatchPromoteGateNo - 1 Then
MsgBox ("WARNING: One or more of the flagged items has not yet
completed all the gates prior to " & _
strBatchPromoteGateName & _
". If you proceed with this batch action, any Line Items in that
category will bypass the intervening, uncompleted gates.")
End If