L
Leslie Isaacs
Hello All
I have the following code behind a button on "frm main":
Dim counter As Integer
For counter = Me.CurrentRecord To Me.RecordsetClone.RecordCount
OpenFormOrReport ("frm_P45_submission")
Do Until Not FormIsOpen("frm_P45_submission")
DoEvents: Sleep 100
Me.SetFocus
Loop
DoCmd.GoToRecord , , acNext
Next counter
This essentially opens "frm_P45_submission": this form then continuously
polls an external government computer, and once the communication is
acknowledged by the government computer, my PC makes a data submission to
it. Then the form is closed, the next record is selected on "frm main", and
the process is repeated. A number of tests need to be made before
"frm_P45_submission" is opened, and these are made as part of the
OpenFormOrReport procedure: if any of the tests fail "frm_P45_submission"
does not open - which is what I want - but the 'test failure message' is
constantly repeated - which is not what I want! It seems as if the code gets
stuck inside the loop, whereas, to my mind, by having "Do Until Not
FormIsOpen", the loop should be exited as soon as "frm_P45_submission" is
found not to be open.
Where have I gone wrong?
Hope soneone can help.
Many thanks
Leslie Isaacs
I have the following code behind a button on "frm main":
Dim counter As Integer
For counter = Me.CurrentRecord To Me.RecordsetClone.RecordCount
OpenFormOrReport ("frm_P45_submission")
Do Until Not FormIsOpen("frm_P45_submission")
DoEvents: Sleep 100
Me.SetFocus
Loop
DoCmd.GoToRecord , , acNext
Next counter
This essentially opens "frm_P45_submission": this form then continuously
polls an external government computer, and once the communication is
acknowledged by the government computer, my PC makes a data submission to
it. Then the form is closed, the next record is selected on "frm main", and
the process is repeated. A number of tests need to be made before
"frm_P45_submission" is opened, and these are made as part of the
OpenFormOrReport procedure: if any of the tests fail "frm_P45_submission"
does not open - which is what I want - but the 'test failure message' is
constantly repeated - which is not what I want! It seems as if the code gets
stuck inside the loop, whereas, to my mind, by having "Do Until Not
FormIsOpen", the loop should be exited as soon as "frm_P45_submission" is
found not to be open.
Where have I gone wrong?
Hope soneone can help.
Many thanks
Leslie Isaacs