RUdebugged
New member
- Local time
- Yesterday, 19:06
- Joined
- Nov 28, 2011
- Messages
- 5
Hello,
This is my first post - forgive me if I get the etiquette wrong.
I have a form with two controls that have exit events coded. Both Exit events move the focus based on some conditions to controls on next records. I added a public sub in a module to backup the database to 2 different locations and that sub is attached to a button on the form. So when I click the button I want the exit code to stop immediately or at some prescibed point like at the end of the record's data entry and carry out the button's 'backup' sub. I'm not sure how to proceed - the procedure in the exit event is necessary but maybe not on that event...
Any help is appreciated. I'll post the exit event code for one of the controls here. BTW I have confirmed that all this code compiles and works as expected separately; I just can't get the one sub to interrupt the exit subs.
Private Sub tbFinalCondition_Exit(Cancel As Integer)
'SetID is dimensioned as a static variable outside the subs
If SetID = False Then
Exit Sub
End If
tbFinalCondition.SetFocus
While SetID = True
If Not (tbFinalCondition.Text = "undamaged") Then DoCmd.GoToRecord acDataForm, "frm_FinalFilters", acNext, 1
End if
If tbFilterID.Value Then
If tbFinalFilterWt.Value Then
Forms!frm_FinalFilters.Recordset.MoveNext
Else
tbFinalFilterWt.SetFocus
Exit Sub
End If
Else
SetID = False
End If
Wend
End Sub
'this is not an issue at the *end* of the form's recordset
This is my first post - forgive me if I get the etiquette wrong.
I have a form with two controls that have exit events coded. Both Exit events move the focus based on some conditions to controls on next records. I added a public sub in a module to backup the database to 2 different locations and that sub is attached to a button on the form. So when I click the button I want the exit code to stop immediately or at some prescibed point like at the end of the record's data entry and carry out the button's 'backup' sub. I'm not sure how to proceed - the procedure in the exit event is necessary but maybe not on that event...
Any help is appreciated. I'll post the exit event code for one of the controls here. BTW I have confirmed that all this code compiles and works as expected separately; I just can't get the one sub to interrupt the exit subs.
Private Sub tbFinalCondition_Exit(Cancel As Integer)
'SetID is dimensioned as a static variable outside the subs
If SetID = False Then
Exit Sub
End If
tbFinalCondition.SetFocus
While SetID = True
If Not (tbFinalCondition.Text = "undamaged") Then DoCmd.GoToRecord acDataForm, "frm_FinalFilters", acNext, 1
End if
If tbFilterID.Value Then
If tbFinalFilterWt.Value Then
Forms!frm_FinalFilters.Recordset.MoveNext
Else
tbFinalFilterWt.SetFocus
Exit Sub
End If
Else
SetID = False
End If
Wend
End Sub
'this is not an issue at the *end* of the form's recordset