E-mail reports with exclusive rights
Help Again
I am using the following code to send a report by e-mail.The only problem is that if two users click on the send button at the same time this will send two reports.I need to add some code that will send only one report from that user and the user clicking on the send button has exclusive rites in sending his/her report.
Private Sub Command37_Click()
On Error GoTo ErrorHandler
If IsNull(Office_Type) Or IsNull(Number_Of_Positions) Or IsNull(Helpdesk_Ref) Or IsNull(Approved_By) Or IsNull(Position) Or IsNull(Reason_For_Replacement) Or IsNull(Software_Version) Or IsNull(Requested_By) Or IsNull(Machine_Type) Or IsNull(Which_Cash_Account) Or IsNull(Comms) Or IsNull(Screen_Type) Or IsNull(Person_Spoke_To) Or IsNull(System_Running_Or_Down) Or IsNull(Priority) Then
MsgBox "All Fields are MANDATORY Except Office Contact And If Net Vista ", vbInformation, "IT Helpdesk SUR"
Else
Me.Status = "Sent"
DoCmd.RunCommand acCmdSaveRecord
Me.Status = "Closed"
DoCmd.SendObject acSendReport, "RPTSUR1", acFormatRTF, "", "", "", " System Unit Replacement " & Office, "System Unit Replacement logged by " & Logged_By, False
emailsent = "True"
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Quit
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit
End If
End Sub
__________________
Brendan Bartley
|