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:
Private Sub gStartStop_AfterUpdate()
If Me.gStartStop = 2 Then 'START button is pressed
Me.gStartStop = 1 'STOP button is pressed
Partial Code of the XYstat(), the loop:
Do While Me.valStartDraw > dblStopDraw And Me.gStartStop = 2 '"START"
Me.txtCounter = "CurDraw: " & Me.valStartDraw & vbNewLine & "LoopNo: " & lnCnt
Me.cmdGetRDraws.Enabled = False
'Create currend bunch of X,Y records
DoCmd.RunSQL "DELETE * FROM tblRecordsXY"
'Calculate and append respective records
DoCmd.OpenQuery "AnalAppendXYrecs", acNormal, acEdit
The problem is that when I click on the STOP button to terminate the loop, I get the error
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.
(kindly see the attachment for the full error) and after I press OK the loop continues and finishes normally, doesn't exit.
Anybody with enough experience can tell me what I'm doing wrong?