Hello,
So i have designed a work order request form that a user fills in. When the user clicks submit to submit the report generated the form checks to make sure the text boxes have values/data in them. If it doesn't it prompts the user with a message box. When all boxes are complete and the vba code acknowledges that all data required is there, it generates a report and fires off an email.
For some reason whenever i get all the data filled in and click submit, the form just flashes at me like it's refreshing and doesn't do nothing. It worked just fine before i put the prompts in there.
So i have designed a work order request form that a user fills in. When the user clicks submit to submit the report generated the form checks to make sure the text boxes have values/data in them. If it doesn't it prompts the user with a message box. When all boxes are complete and the vba code acknowledges that all data required is there, it generates a report and fires off an email.
For some reason whenever i get all the data filled in and click submit, the form just flashes at me like it's refreshing and doesn't do nothing. It worked just fine before i put the prompts in there.
Code:
Private Sub Command569_Click()
Dim strReport As String
strReport = "rptNewWorkOrder"
Me.Refresh
If IsNull(Me.RequistionedBy) Then
MsgBox "Who is this workorder requested by?"
ElseIf IsNull(Me.RequistionedDate) Then
MsgBox "What is the date of this workorder request?"
ElseIf IsNull(Me.cboEquipmentType) Then
MsgBox "What is the equipment Type?"
ElseIf IsNull(Me.cboPlantNum) Then
MsgBox "What is the Plant #?"
ElseIf IsNull(Me.Combo577) Then
MsgBox "What is the Unit/Equipment ID?"
ElseIf IsNull(Me.Priority) Then
MsgBox "What is the priority of this work order?"
ElseIf IsNull(Me.RepairType) Then
MsgBox "What is the repair type of this work order?"
ElseIf IsNull(Me.WorkScope) Then
MsgBox "What is the scope of work?"
End If
Exit Sub
DoCmd.OpenReport strReport, acViewPreview, , "WorkORderid = " & Me!WorkOrderID
DoCmd.SendObject acSendReport, "rptNewWorkOrder", "PDF", "First.Last@Email.com;First.Last@Email.com", , , "New Work Order", "", False
DoCmd.Close acForm, "frmworkorderrequestnew", acSaveYes
DoCmd.Close acReport, "rptNewWorkOrder", acSaveYes
End Sub