Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 2nd, 2005, 04:33 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old August 2nd, 2005, 11:49 PM
Friend of Wrox
 
Join Date: Jul 2005
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think the problem is that two users can be editing the same record at the same time. This is a system design issue. You should not be needing to do this if the process is working properly.

But is you do want to do this then

Before these lines:

Me.Status = "Sent"
DoCmd.RunCommand acCmdSaveRecord

you will need to query the table to see what the value is in the table is for the field [Status]. Could use DLOOKUP in the tables ae not attached.

If the status is not "Sent" ot "closed" then send the email


Boyd
Access Based Accounting/Business Solutions developer.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail merge using Crystal Reports XI YatinTamhane Crystal Reports 0 July 8th, 2005 01:56 PM
Exclusive ADO Connection bsa Pro VB Databases 1 September 6th, 2004 07:16 AM
Exclusive ADO Connection bsa SQL Server 2000 2 August 24th, 2004 12:10 AM
Exclusive selection RobbieGee MySQL 2 July 5th, 2004 04:35 PM
cursor; onload, mail or print multiple reports bubblez Access VBA 2 November 3rd, 2003 04:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.