I am trying to prevent users from changing status 4 orders.
I am using the following code, Is there anyway to close the form or exit?
Private Sub DiscPct1_GotFocus()
Dim statrs As Recordset
Dim statstmt As String
Dim ord As String
ord = macForm.No.Text
Call OpenMacolaConnection
Set statrs = New ADODB.Recordset
statstmt = "SELECT OEORDHDR.ORDER_STATUS FROM OEORDHDR " _
& " WHERE OEORDHDR.ORDER_NO= '" & ord & "'"
statrs.Open statstmt, Macola, adOpenforward, adLockReadOnly, adCmdText
If statrs(0) = 4 Then
MsgBox "Changes not Allowed This order is a Status 4"
macForm.macExit
End If
I am using the following code, Is there anyway to close the form or exit?
Private Sub DiscPct1_GotFocus()
Dim statrs As Recordset
Dim statstmt As String
Dim ord As String
ord = macForm.No.Text
Call OpenMacolaConnection
Set statrs = New ADODB.Recordset
statstmt = "SELECT OEORDHDR.ORDER_STATUS FROM OEORDHDR " _
& " WHERE OEORDHDR.ORDER_NO= '" & ord & "'"
statrs.Open statstmt, Macola, adOpenforward, adLockReadOnly, adCmdText
If statrs(0) = 4 Then
MsgBox "Changes not Allowed This order is a Status 4"
macForm.macExit
End If