Jim-
No way that small change causes a divide by zero. Which statement is blowing up?
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
On Jun 8, 2015, at 6:56 PM, Jim Wagner luvmymelody@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Robert,
I get a division by zero error
Jim Wagner
On Monday, June 8, 2015 9:53 AM, "'Robert Peterson' bob@alternatefinishing.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:
I believe you need &"\" added to the end of mypath like so.
DoCmd.OutputTo acOutputReport, "rptVehicleVPOCValidationAnnouncement", acFormatPDF, myPath & "\" & "Report-All Users" & ".pdf", False
Bob Peterson
.
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Monday, June 08, 2015 12:36 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Code not saving to the correct folder
Sent: Monday, June 08, 2015 12:36 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Code not saving to the correct folder
Hello all,
I have some code that emails out a report to users. Everything works except the path of the file in code does not put the file in the correct place. I have looked at the code for several days and cannot understand why the report is not being saved to the correct folder. I am now in a state that I just see the same thing over and over. I do not have any perspective of what is happening. I am hoping that someone can see the issue.
The file is being saved currently as Outputted ReportsReport-All Users.pdf in the S:\Fleet Services Reporting folder. It should be going to the S:\Fleet Services Reporting\Outputted Reports folder as Report-All Users.pdf. I just do not see it clearly anymore after 2 days. Below is the code
Any help will be appreciated.
Thank You
Jim Wagner
Private Sub cmdEmail_Click()
' This process genera tes the full report for the vehicle's which have their emissions due on the date given by the user on the main form and sends
' report .
' report .
MsgBox ("This will send out out the emails. Please make sure to work offline.")
Dim RS_1 As DAO.Recordset
Dim db As DAO.Database
Dim strSQL As String
Dim sSQL As String
Dim RS_1 As DAO.Recordset
Dim db As DAO.Database
Dim strSQL As String
Dim sSQL As String
Set db = CurrentDb
' Disable all warnings
DoCmd.SetWarnings False
DoCmd.SetWarnings False
' myPath stores the path of the directory which stores the outputted reports
myPath = "S:\Fleet Services Reporting\Outputted Reports"
myPath = "S:\Fleet Services Reporting\Outputted Reports"
' Open the REPORT to be emailed
' Apply filter to open the report for the given contact name only
DoCmd.OpenReport "rptVehicleVPOCValidationAnnouncement", acViewReport, , , , "False"
; 'the source for the report is
'qryVehicleAnnouncment
'AllActiveVehicles
'from cmms
'VehicleContacts
'from cmms
' Save the Report as .html at myPath with a file name of the [Contact Name]
&n bsp; ' We also append the '.html' file extension at the end of the file name
DoCmd.OutputTo acOutputReport, "rptVehicleVPOCValidationAnnouncement", acFormatPDF, myPath & "Report-All Users" & ".pdf", False
' Close the Report
DoCmd.Close acReport, "rptVehicleVPOCValidationAnnouncement" 'which is a report
'the source for the report is
'qryVehicleAnnouncment
'AllActiveVehicles
&nb sp; 'from cmms
'VehicleContacts
'from cmms
DoCmd.SetWarnings True
' Apply filter to open the report for the given contact name only
DoCmd.OpenReport "rptVehicleVPOCValidationAnnouncement", acViewReport, , , , "False"
; 'the source for the report is
'qryVehicleAnnouncment
'AllActiveVehicles
'from cmms
'VehicleContacts
'from cmms
' Save the Report as .html at myPath with a file name of the [Contact Name]
&n bsp; ' We also append the '.html' file extension at the end of the file name
DoCmd.OutputTo acOutputReport, "rptVehicleVPOCValidationAnnouncement", acFormatPDF, myPath & "Report-All Users" & ".pdf", False
' Close the Report
DoCmd.Close acReport, "rptVehicleVPOCValidationAnnouncement" 'which is a report
'the source for the report is
'qryVehicleAnnouncment
'AllActiveVehicles
&nb sp; 'from cmms
'VehicleContacts
'from cmms
DoCmd.SetWarnings True
Dim objol As New Outlook.Application
Dim objmail As MailItem
Set objol = New Outlook.Application
Dim outputFileName
' We set the output file name to Report-All Users.html
outputFileName = "S:\Fleet Services Reporting\Outputted Reports\Report-All Users.pdf"
outputFileName = "S:\Fleet Services Reporting\Outputted Reports\Report-All Users.pdf"
' Email Process begins
Set objmail = objol.CreateItem(olMailItem)
With objmail
Set objmail = objol.CreateItem(olMailItem)
With objmail
' This allows the email to be sent out from the fleet services email id instead of the personal one
o bjmail.SentOnBehalfOfName = "Fleet-Services@exchange.asu.edu"
.To = luvmymelody@yahoo.com"
' Set the subject
.Subject = "Vehichle Audit User Report"
' Set the body
.Body = "Attached is the report of all the users."
.NoAging = True
' Attach the report
.Attachments.Add outputFileName
.Display
End With
o bjmail.SentOnBehalfOfName = "Fleet-Services@exchange.asu.edu"
.To = luvmymelody@yahoo.com"
' Set the subject
.Subject = "Vehichle Audit User Report"
' Set the body
.Body = "Attached is the report of all the users."
.NoAging = True
' Attach the report
.Attachments.Add outputFileName
.Display
End With
' Send the email out
SendKeys "%{s}", True
SendKeys "%{s}", True
'disable the cmdEmail button
Me!cmdEmail.Enabled = False
Me!cmdEmail.Enabled = False
'get the cmd_EditVehicleAuditAnnouncementEmailBody button to be visible
Me!cmd_EditVehicleAuditAnnouncementEmailBody.Visible = True
Me!cmd_EditVehicleAuditAnnouncementEmailBody.Visible = True
Me!cmd_EditVehicleAuditAnnouncementEmailBody.Visible = TrueMe!lblStep.Visible = True
Me!lblStep.Top = 5820
Me!lblStep.Left = 8159
Me!lblStep.Caption = "Step 5"
Me!lblInstructions.Visible = True
Me!lblInstructions.Caption = "This will open the Vehicle Announcement Body form for users to edit the text that will be used in the body of the email message"
Me!cmdOpenCMMSWebpage.Visible = False
Me!lblStep.Top = 5820
Me!lblStep.Left = 8159
Me!lblStep.Caption = "Step 5"
Me!lblInstructions.Visible = True
Me!lblInstructions.Caption = "This will open the Vehicle Announcement Body form for users to edit the text that will be used in the body of the email message"
Me!cmdOpenCMMSWebpage.Visible = False
' Inform the user that the report has been mailed
MsgBox "Report has been emailed"
Me!linProgressBar.Visible = True
Me!linProgressBar.Width = 12239
MsgBox "Report has been emailed"
Me!linProgressBar.Visible = True
Me!linProgressBar.Width = 12239
End Sub
__._,_.___
Posted by: John Viescas <johnv@msn.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (6) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar