I have a form with unbound fields and using an option group (gStartStop) with two buttons, Start/Stop, I want to control the execution of a DO WHILE loop where a series of actions are performed, including action queries.
Code of the option group:
Partial Code of the XYstat(), the loop:
The problem is that when I click on the STOP button to terminate the loop, I get the error
Anybody with enough experience can tell me what I'm doing wrong?
Thank you!
Code of the option group:
Code:
Private Sub gStartStop_AfterUpdate()
If Me.gStartStop = 2 Then 'START button is pressed
Call XYstat
Else
Me.gStartStop = 1 'STOP button is pressed
End If
End Sub
Code:
Do While Me.valStartDraw > dblStopDraw And [B]Me.gStartStop = 2[/B] '"START"
Call cmdGetRDraws_Click
'Show counter
Me.txtCounter = "CurDraw: " & Me.valStartDraw & vbNewLine & "LoopNo: " & lnCnt
DoEvents
Me.cmdGetRDraws.Enabled = False
'Create currend bunch of X,Y records
DoCmd.SetWarnings False
'Empty table
DoCmd.RunSQL "DELETE * FROM tblRecordsXY"
'Calculate and append respective records
DoCmd.OpenQuery "AnalAppendXYrecs", acNormal, acEdit
[B]...etc[/B]
Loop
(kindly see the attachment for the full error) and after I press OK the loop continues and finishes normally, doesn't exit.The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Microsoft Office Access from saving the data in the field.
Anybody with enough experience can tell me what I'm doing wrong?
Thank you!