D
DawnTreader
Hello All
If Me.SRServRepWOValid = True Then
If IsNull(Me.PONumber) Then
MsgBox "Has the Customer issued a Purchase Order for the service?"
Me.PONumber.SetFocus
Else
If IsNull(Me.WorkOrderNumber) Then
MsgBox "Service Reports cannot be submitted with out a work
order.", vbOKOnly, "Work Order Required"
Me.WorkOrderNumber.SetFocus
Else
If IsNull(Me.ReasonForCall) Then
MsgBox "What was the reason for the service call?",
vbOKOnly, "Reason for Service Empty"
Me.ReasonForCall.SetFocus
Else
If IsNull(Me.ServicePerformed) Then
MsgBox "What service did you perform?", vbOKOnly,
"Service Performed Empty"
Me.ServicePerformed.SetFocus
Else
If IsNull(Me.SRSubmittedDate) Then
Me.SRSubmittedDate = Date
End If
Me.SRStatusID = 2
Call cmdSave_Click
End If
End If
End If
End If
End If
i have tried to think of a better way to do this, in the past i have used a
validation system like this:
Private Sub cmdClose_Click() '3rd level action
If (ValidateForm = True) Then
DoCmd.Close acForm, "frmManageServiceReports"
Call refresh_lists
Else
Me.ServiceReportDate.SetFocus
End If
End Sub
Private Function ValidateForm()
Dim Valid As Boolean
Valid = True
Select Case Me.ServiceReportDate
Case Me.ServiceReportDate > Now()
MsgBox "Service Report Date is in the Future", vbOKOnly, "Date
Error"
Valid = False
Case IsNull(Me.ServiceReportDate) = True
MsgBox "Service Report Date is missing.", vbOKOnly, "Date
Required"
Valid = False
End Select
ValidateForm = Valid
End Function
problem is that i need the code to drop the user at the first field that
isnt valid.
anyone have an idea of how to cause the validation to send the user to the
field that first caused the validation to fail?
If Me.SRServRepWOValid = True Then
If IsNull(Me.PONumber) Then
MsgBox "Has the Customer issued a Purchase Order for the service?"
Me.PONumber.SetFocus
Else
If IsNull(Me.WorkOrderNumber) Then
MsgBox "Service Reports cannot be submitted with out a work
order.", vbOKOnly, "Work Order Required"
Me.WorkOrderNumber.SetFocus
Else
If IsNull(Me.ReasonForCall) Then
MsgBox "What was the reason for the service call?",
vbOKOnly, "Reason for Service Empty"
Me.ReasonForCall.SetFocus
Else
If IsNull(Me.ServicePerformed) Then
MsgBox "What service did you perform?", vbOKOnly,
"Service Performed Empty"
Me.ServicePerformed.SetFocus
Else
If IsNull(Me.SRSubmittedDate) Then
Me.SRSubmittedDate = Date
End If
Me.SRStatusID = 2
Call cmdSave_Click
End If
End If
End If
End If
End If
i have tried to think of a better way to do this, in the past i have used a
validation system like this:
Private Sub cmdClose_Click() '3rd level action
If (ValidateForm = True) Then
DoCmd.Close acForm, "frmManageServiceReports"
Call refresh_lists
Else
Me.ServiceReportDate.SetFocus
End If
End Sub
Private Function ValidateForm()
Dim Valid As Boolean
Valid = True
Select Case Me.ServiceReportDate
Case Me.ServiceReportDate > Now()
MsgBox "Service Report Date is in the Future", vbOKOnly, "Date
Error"
Valid = False
Case IsNull(Me.ServiceReportDate) = True
MsgBox "Service Report Date is missing.", vbOKOnly, "Date
Required"
Valid = False
End Select
ValidateForm = Valid
End Function
problem is that i need the code to drop the user at the first field that
isnt valid.
anyone have an idea of how to cause the validation to send the user to the
field that first caused the validation to fail?