Hello
i have a button which automaticly sends an email when pressed to someone else within the company to authorise credit, despite text on the screen people still click the button when no credit is required, so i need to restrict this if the credit is zero
i have the code below which seems to work fine message box comes up saying no credit needed, however i need to then cancel the click action and return to the form and am not sure how to go about this.
I have left a gap in the text wher i think this should be and would be most grateful if anyone has the solution
TIA
Private Sub Command44_Click()
On Error GoTo Err_command44_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
If [credit amount] < 1 Then MsgBox "no credit is required"
Dim stDocName As String
stDocName = "credit approved"
DoCmd.OpenReport stDocName, acViewPreview, , "[complaint No]=" & Forms![manager input1]![complaint No]
MsgBox "opening E-mail"
DoCmd.SendObject acReport, "credit approved", "RichTextFormat(*.rtf)", _
"e-mail;e-mail", , , "Credit Authorisation required", "A Customer Contact on the Data base requires authorisation", True
MsgBox "E-Mail has been sent"
DoCmd.Close
Exit_command44_Click:
Exit Sub
Err_command44_Click:
MsgBox Err.Description
Resume Exit_command44_Click
End Sub
i have a button which automaticly sends an email when pressed to someone else within the company to authorise credit, despite text on the screen people still click the button when no credit is required, so i need to restrict this if the credit is zero
i have the code below which seems to work fine message box comes up saying no credit needed, however i need to then cancel the click action and return to the form and am not sure how to go about this.
I have left a gap in the text wher i think this should be and would be most grateful if anyone has the solution
TIA
Private Sub Command44_Click()
On Error GoTo Err_command44_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
If [credit amount] < 1 Then MsgBox "no credit is required"
Dim stDocName As String
stDocName = "credit approved"
DoCmd.OpenReport stDocName, acViewPreview, , "[complaint No]=" & Forms![manager input1]![complaint No]
MsgBox "opening E-mail"
DoCmd.SendObject acReport, "credit approved", "RichTextFormat(*.rtf)", _
"e-mail;e-mail", , , "Credit Authorisation required", "A Customer Contact on the Data base requires authorisation", True
MsgBox "E-Mail has been sent"
DoCmd.Close
Exit_command44_Click:
Exit Sub
Err_command44_Click:
MsgBox Err.Description
Resume Exit_command44_Click
End Sub