Hello all,
The following modules are from a Continuous Forms view form.
I want to check the TSTATUS and if it is 'S02' to provide the option of selecting a Vendor from the TSinfo.
Then I want to check again for a null value, allowing however the option of a null value, if the user exits TSinfo (maybe accidentally) without selecting a Vendor.
For some strange reason, the Exit event fires twice (the strmsg pops up twice) if the user (lets say by mistake) clicks on another record.
I've tried different ways, including the Before Update, but this is what suits me most.
Can anybody help me make it to work and maybe explain why this happens?
Your any assistance is greatly appreciated!
=================================
Private Sub TSinfo_Exit(Cancel As Integer)
Dim strmsg As String
strmsg = "You forgot to select a Vendor!" & vbCrLf & "Will you be placing an order?"
If IsNull(Me.TSinfo) And MsgBox(strmsg, vbCritical + vbYesNo, "Attention!!!") = vbYes Then
Cancel = True
Else
Me.TSTATUS.SetFocus
Me.TSinfo.Enabled = False
End If
End Sub
Private Sub TSTATUS_AfterUpdate()
If Me.TSTATUS = "S02" Then
AskUser = MsgBox("If you place an order you have to provide a Vendor!" & vbCrLf & _
"Will you place an order?", vbCritical + vbYesNo, "Attention!!!")
End If
If AskUser = vbYes Then
Me.TSinfo.Enabled = True
Me.TSinfo.SetFocus
Else
Me.TSTATUS.SetFocus
Me.TSinfo.Enabled = False
End If
End Sub
The following modules are from a Continuous Forms view form.
I want to check the TSTATUS and if it is 'S02' to provide the option of selecting a Vendor from the TSinfo.
Then I want to check again for a null value, allowing however the option of a null value, if the user exits TSinfo (maybe accidentally) without selecting a Vendor.
For some strange reason, the Exit event fires twice (the strmsg pops up twice) if the user (lets say by mistake) clicks on another record.
I've tried different ways, including the Before Update, but this is what suits me most.
Can anybody help me make it to work and maybe explain why this happens?
Your any assistance is greatly appreciated!
=================================
Private Sub TSinfo_Exit(Cancel As Integer)
Dim strmsg As String
strmsg = "You forgot to select a Vendor!" & vbCrLf & "Will you be placing an order?"
If IsNull(Me.TSinfo) And MsgBox(strmsg, vbCritical + vbYesNo, "Attention!!!") = vbYes Then
Cancel = True
Else
Me.TSTATUS.SetFocus
Me.TSinfo.Enabled = False
End If
End Sub
Private Sub TSTATUS_AfterUpdate()
If Me.TSTATUS = "S02" Then
AskUser = MsgBox("If you place an order you have to provide a Vendor!" & vbCrLf & _
"Will you place an order?", vbCritical + vbYesNo, "Attention!!!")
End If
If AskUser = vbYes Then
Me.TSinfo.Enabled = True
Me.TSinfo.SetFocus
Else
Me.TSTATUS.SetFocus
Me.TSinfo.Enabled = False
End If
End Sub