Page 2 of 2 FirstFirst 12
Results 16 to 30 of 30
  1. #16
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I was unable to get it to work with a Gmail account. I tried both port 465 and 25. That is unfortunate. I am able to get it to work and use it all the time with email services I pay for. The code I provided works on XP machines with and without Outlook as well as W7 with Outlook 2010.



    As for it not working for you with the exchange server on the LAN at work. I can only guess at that. Perhaps there are newer API's that would work. Perhaps they firewall this type of activity/protocol on Port 25. I really don't know.

  2. #17
    voldatabase is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    14
    While IT had installed CDO on the local Exchange server, sending the EMail to the local Exchange / SMTP server still gave the same errors - possibly a configuration issue. However IT did come up with an excellent, outside the box, solution - send it to the SMTP server 'smtp.our_isp.com' IP address.

    I reconfigured the code to look at the new address and sent my test EMail using suitably modified # 7 code and I had the test EMail by the time I had logged into my personal webmail account, complete with readable attachment.

    This solves the EMail sending part of my immediate issues. I am still battling with the sending the individualized report to different clients - viz. the looping through the individual EMail addresses.

    I have seen suggestions relating to "SELECT DISTINCT" and am currently investigating this as a method.

    Thank you very much for your help in getting the EMail sending part of this issue sorted. That CDO method works GREAT!!!

    Thanks and regards

    Alex

  3. #18
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Give me a chance to take a look at it and see. I need to refresh my memory. If I recall, you already have a select query. We just need to save the report. It may already be in separate reports as it sits. If not, we simply add a where clause.

    At least you have the email thing sorted. Now it is just a matter of getting your report saved to disc, formatting the email, and adding your stationary features.

    When I have a chance, I will see what needs focus next.

  4. #19
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Can you upload a copy of your DB? At least the forms, reports, queries, and tables involved with this email process?

    If you have to, go ahead and delete the data. Make sure you delete your password in the CDO VBA.

    Tell me exactly how you need to choose the OrganisationID's that get an email. You mentioned something about date. I am looking only for the criteria that determines who gets an email not what information they get. The SQL statement already states what info to select.

  5. #20
    voldatabase is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    14
    The original DB is huge, so I have tried to create a small copy of the DB with just the relevant tables (with enough data to run the report), query and report (no forms involved in this operation - just run the report).

    Unfortunately MS could not get the copy-and-paste process from the original DB to a new DB correct and complete, so all my one-to-many and many-to-one relationships that were functioning in the original DB, now do not work in the new DB. So this means that my query / report combo that worked perfectly, is now not working in the new DB.

    I have searched the web and Access Help to try to find out how this may be done, with no success, so I am unable to fix this.

    I have therefore included a screen capture (qryEMailInsuranceWarning.png) of the original query with the one-to-many and many-to-one relationships shown.

    Attached please find the minimal copy - AccessForumsEmptyDB.accdb

    Thanks again for your efforts.

    Regards

    AlexClick image for larger version. 

Name:	qryEMailInsuranceWarning.png 
Views:	23 
Size:	61.5 KB 
ID:	14382AccessForumsEmptyDB.zip

  6. #21
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I will take a look at it and get back to you.

  7. #22
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    In order to create, save, and email the seperate reports, we need a form to work from. I created a form that will look at all of the records and then you can toggle to view the ones that are due to expire in 30 days or less. Then there is an option to email. Right now there is not email code but the control button will create the PDF files.

    You can import the query and form AND REPORT objects into your DB to test what I have created. You will need to create a couple folders in you C drive for the code to work (create and store the PDF files). I did not add MakeDir to the VBA...

    The code in the form is doing the heavy lifting. I totaly abandoned your SELECT DISTINCT query. It makes no sense to group by when we can write code to manage the 30 day rule. The only thing the SELECT DISTINCT was doing is grouping 30 day expirery dates. So, no need to incorporate tblDefaulSettings. You can add the table to the form later if the User needs it for reference while they are working. Right now, the form is based off one rule. 30days or less.

    I changed all of the queries. The report get's a query and the form gets a query. There is also a sub query to help manage the relative tables. The report only has like 5 fields, so there is no need to include all of the tables/fields in its query.

    SampleAccessForums.zip

    Hope this helps to resolve the email dilema

  8. #23
    voldatabase is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    14
    Thank you very much. Based on the very quick test of what you have sent, this works a treat!!!

    After creating the relevant directory and running the report, there were two .pdfs in that directory and looking GOOD!!!!

    Unfortunately, while I have been involved in all this 'fun stuff' - programming etc., all the 'donkey work' (read 'data capture') has been piling up around me, and those higher up the food-chain are wanting their data captured ASAP, so I will not be able to get my teeth into the 'fun stuff' until that has been done - hopefully by next week. Sad when work gets in the way of fun.

    Thanks once again for all your efforts in this regard.

    I will get back to as soon as I get all the 'work' behind me.

    Kind regards

    Alex

  9. #24
    voldatabase is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    14
    I have finally got round to testing this in our test environment.

    Due to legal impositions / requirements I have had to modify the lead time from your 31 days to 45 days. This means that anyone whose insurance lapses within the next 45 days, from the date of running the report, gets a warning letter.

    This means that I have had to make some modifications to your original code (see below), and that is where I have bogged down again:-

    Private Sub tglShow_Click()


    Dim strShow As String
    Dim dtWarn As Date

    dtWarn = Date + 45 'Determine the date for warnings ' # Modified from 31



    If Me.tglShow.Value = -1 Then

    Me.tglShow.Caption = "Show All"
    ' # Original Code starts
    ' # <
    ' # strShow = "SELECT * FROM qryInsView WHERE (TblRegistration.PublicLiabilityInsurer)< #" _
    ' # & dtWarn & _
    ' # "# OR (TblRegistration.PersonalAccidentInsurer)< #" _
    ' # & dtWarn & "#"
    ' # >
    ' # Original Code ends

    ' # Modified Code starts
    ' # <
    strShow = "SELECT * FROM qryInsEmailWarnView WHERE ((TblRegistration.PublicLiabilityExpiryDate)>= #" & Date & "# AND <= #" & dtWarn & "#) OR ((TblRegistration.PersonalAccidentExpiryDate)>= #" & Date & "# AND <= #" & dtWarn & "#)"
    ' # >
    ' # Modified Code ends

    Me.cmdEmail.Visible = True

    Debug.Print strShow

    Else

    Me.tglShow.Caption = "Show Some"
    strShow = "SELECT * FROM qryInsEmailWarnView"
    Me.cmdEmail.Visible = False

    End If

    Me.RecordSource = strShow 'Adjust the Form's Recordsource


    End Sub

    Clicking on the toggle button returns the following in the VBA "Immediate Window":-
    SELECT * FROM qryInsEmailWarnView WHERE (TblRegistration.PublicLiabilityExpiryDate)>= #12/12/2013# AND <= #26/01/2014#) OR ((TblRegistration.PersonalAccidentExpiryDate)>= #12/12/2013# AND <= #26/01/2014#)

    Which looks OK to me since all the correct dates were returned, but I get an error message(?):-

    Run-time error '3075':
    Syntax error (missing operator) in query expression ((TblRegistration.PublicLiabilityExpiryDate)>= #" & Date & "# AND <= #" & dtWarn & "#) OR ((TblRegistration.PersonalAccidentExpiryDate)>= #" & Date & "# AND <= #" & dtWarn & "#)".

    I have checked for missing parenthesis and spaces in this and don't see anything wrong.

    When I click on the 'Debug' button in the error message, I get pointed to a line of code that I have not touched / modified and is some lives below where I am working.
    Me.RecordSource = strShow 'Adjust the Form's Recordsource


    Any help with this would be very much appreciated.


    Thanks and regards

    Alex

  10. #25
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    This is the original code I provided for the control named tglShow. All you have to do is adjust 31 to the value desired. In the case you described, that value would be 45. I downloaded the DB and did not have any errors when I changed 31 to 45.

    The toggle control only adjusts a portion of the Where criteria.


    Code:
    Private Sub tglShow_Click()
    
    Dim strShow As String
    Dim dtWarn As Date
        dtWarn = Date - 31 'Determine the date for warnings
        
        
            If Me.tglShow.Value = -1 Then
            
                Me.tglShow.Caption = "Show All"
                strShow = "SELECT * FROM qryInsView WHERE (TblRegistration.PublicLiabilityInsurer)< #" _
                & dtWarn & _
                "# OR (TblRegistration.PersonalAccidentInsurer)< #" _
                & dtWarn & "#"
                Me.cmdEmail.Visible = True
            
            Debug.Print strShow
            
            Else
            
                Me.tglShow.Caption = "Show Some"
                strShow = "SELECT * FROM qryInsView"
                Me.cmdEmail.Visible = False
            
            End If
        
        Me.RecordSource = strShow   'Adjust the Form's Recordsource
    
    End Sub

  11. #26
    voldatabase is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    14
    Unfortunately, due to historical issues, we do need the "within the next 45 days" logic. That is why the "less than" logic needed to change to "between today and 45 days hence" logic.

    Sorry, maybe I did not explain that earlier - my bad

    Thanks

    Alex

  12. #27
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    You are right. The code I provide did not do the job. Can you test this for me? It seems to work. I was pretty tired and rushed to get that previous code out.

    Code:
    Private Sub tglShow_Click()
    
    Dim strShow As String
    Dim dtWarn As Date
    Dim dtToday As Date
    
        dtWarn = Date + 45  'Determine the date for warnings
        dtToday = Date
        
            If Me.tglShow.Value = -1 Then
            
    strShow = "SELECT * FROM qryInsView WHERE TblRegistration.PublicLiabilityExpiryDate Between " & "#" & dtToday & "#" & " And " & "#" & dtWarn & "#" _
            & "or (TblRegistration.PersonalAccidentExpiryDate) Between " & "#" & dtToday & "#" & " And " & "#" & dtWarn & "#"
    
                Me.cmdEmail.Visible = True
            
            Else
            
                Me.tglShow.Caption = "Show Some"
                strShow = "SELECT * FROM qryInsView"
                Me.cmdEmail.Visible = False
            
            End If
        
        Me.RecordSource = strShow   'Adjust the Form's Recordsource
    Me.Requery
    End Sub

  13. #28
    voldatabase is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    14
    YYYYYEEEESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


    Absolutely puurrrrrrrfffect.

    All the records I wanted to see are now reflected in the "Show who is due a reminder" view.

    Thanks very, very much for your very prompt and very correct solution.

    As they say in the local vernacular "Yer a bloody Legend Mate!!" - Ozi slang for "Great job! Thanks".

    I will now add the CDO code in and give it a test run.

    Thank you once again.

    Kind regards

    Alex

  14. #29
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Good to hear!

  15. #30
    voldatabase is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    14

    This issue can be closed and marked as solved

    Quote Originally Posted by ItsMe View Post
    Good to hear!
    Thank you for your help.

    Herewith the final code used in this project:-
    Option Compare Database
    Private Sub Form_Load()
    Me.cmdEmail.Visible = False
    Dim rs As DAO.Recordset
    Set rs = Me.RecordsetClone

    Dim strDefaultPath As String
    Dim strPath As String
    Dim strFileName As String
    Dim dtCheck As String
    Dim strLogFileName As String
    Dim strFirstTwoChars As String
    Dim d As String, ext, X
    Dim srcPath As String, destPath As String, srcFile As String
    dtCheck = Format(Now, "mmyyyy")
    strLogFileName = mnthSent & "EmailSent"
    strDefaultPath = rs![DatabaseWorkPath]
    srcPath = strDefaultPath & "\EmailReminders\Temp\"
    destPath = strDefaultPath & "\EmailReminders\OldLogs\"
    On Error Resume Next

    ' Routine to remove the previous months 'Current' Logfile from the temporary folder, and move it to the archive folder.
    ' This only happens on the first access of this form at the beginning of every new month.
    If Left(Dir(srcPath), 6) <> dtCheck Then
    d = Dir(srcPath)
    srcFile = srcPath & d
    FileCopy srcFile, destPath & d
    Kill srcFile
    End If
    strPath = strDefaultPath & "\EmailReminders\Temp\"

    If Left(Dir(strPath), 6) = dtCheck Then
    ' Message box to inform the user that the Insurance reminder EMails have already been sent
    Dim Msg, Style, Title, Help, Ctxt, Response, MyString
    MsgBox "The EMailed reminders have been sent for this month already." & vbCrLf & vbCrLf & "Thanks for checking.", vbOKOnly, "EMails Already Run" ' ' Define message, buttons and title.
    Style = vbOKCancel ' Define buttons.
    Title = "EMails Already Run" ' Define title.
    End If
    strShow = "SELECT * FROM qryListMemberOrganisationDetailsEMail"
    Me.RecordSource = strShow 'Adjust the Form's Recordsource
    Me.Requery
    End Sub

    Private Sub tglShowReminder_Click()


    ' This 'button click' routine is to show which organisations are due for a reminder.
    ' This will also either show the "Send Email" button or a message box to inform the
    ' user that the Insurance reminder EMails have already been sent

    If Me.tglShowReminder.Value = -1 Then
    Me.tglShowReminder.Caption = "Show All"
    ' Routine to print report for those without EmailAddress
    Set rs = Me.RecordsetClone
    Dim strDefaultPath As String
    Dim strPath As String
    Dim strFileName As String
    Dim dtCheck As String
    Dim strLogFileName As String
    Dim strFirstTwoChars As String
    Dim d As String, ext, X
    Dim srcPath As String, destPath As String, srcFile As String
    dtCheck = Format(Now, "mmyyyy")
    strLogFileName = mnthSent & "EmailSent"
    strDefaultPath = rs![DatabaseWorkPath]
    srcPath = strDefaultPath & "\EmailReminders\Temp\"
    destPath = strDefaultPath & "\EmailReminders\OldLogs\"
    On Error Resume Next

    ' Routine to check if there are any reminders required for those organisations that do not have EMail addresses
    If Left(Dir(srcPath), 6) <> dtCheck Then
    If DCount("*", "qryLetterInsuranceReminder") > 0 Then
    Dim strNoEmailWhere As String
    Dim strNoEmailTo As String
    strNoEmailWhere = "OrganisationID = '" & [organisationID] & "'"
    strNoEmailTo = "SELECT * FROM qryLetterInsuranceReminder"

    ' Message box to inform the user that the printer needs to be used now
    MsgBox "There is a reminder that needs to be printed for an Orgainsation without EMail address." & vbCrLf & vbCrLf & _
    "When you exit this Message box, please click on the printer icon at the top left of the screen." & vbCrLf & vbCrLf & _
    "Please click on the OK button below to exit this message box and then Print.”"
    DoCmd.OpenReport "rptInsuranceReminderLetter", acViewPreview
    End If
    End If
    strPath = strDefaultPath & "\EmailReminders\Temp\"

    If Left(Dir(strPath), 6) = dtCheck Then
    ' Message box to inform the user that the Insurance reminder EMails have already been sent
    Dim Msg, Style, Title, Help, Ctxt, Response, MyString
    MsgBox "The EMailed reminders have been sent for this month already." & vbCrLf & vbCrLf & "You can only view the relevant records until next month. ", vbOKOnly, "EMails Already Run" ' ' Define message, buttons and title.
    Style = vbOKCancel ' Define buttons.
    Title = "EMails Already Run" ' Define title.
    Else
    Me.cmdEmail.Visible = True
    End If

    strShow = "SELECT * FROM qryEMailInsuranceReminder"
    rs.MoveNext
    rs.MoveFirst

    Else
    Me.tglShowReminder.Value = 0
    Me.tglShowReminder.Caption = "Show who is due a reminder"
    strShow = "SELECT * FROM qryListMemberOrganisationDetailsEMail"
    Me.cmdEmail.Visible = False

    End If
    Me.RecordSource = strShow 'Adjust the Form's Recordsource
    Me.Requery
    End Sub

    Private Sub cmdEmail_Click()

    ' This is where we generate the E-Mail.

    Dim rs As DAO.Recordset
    Set rs = Me.RecordsetClone

    Dim strWhere As String
    Dim strPath As String
    Dim strLogFileName As String
    Dim mnthSent As String
    Dim strFileName As String
    Dim strTo As String
    Dim strSubject As String
    Dim strInfo As String
    Dim strLineSeparator1 As String
    Dim strEndingSalutation As String
    Dim strTitle1 As String
    Dim strNRCG As String
    ' strDefaultPath is the full path to the relevant disk folder.
    ' This is an Adminstrator settable parameter in the VSM 'Default Settings'
    Dim strDefaultPath As String
    Dim smtpserverDNS As String
    Dim sendemailaddress As String

    strDefaultPath = rs![DatabaseWorkPath]
    smtpserverDNS = rs![smtpserverDNS]
    sendemailaddress = rs![sendemailaddress]

    mnthSent = Format(Date, "mmyyyy") 'Variable used in the LogFileName below


    strPath = strDefaultPath & "\EmailReminders\Temp\"

    strLogFileName = mnthSent & "EmailSent" 'Naming the LogFile
    ' Then output the LogFile to the disk folder path.
    ' The output format is defined as a Comma Delimited file with '.txt' appended
    DoCmd.TransferText acExportDelim, , "qryLogFileEMailInsuranceReminder", strPath & strLogFileName & ".txt", True

    Set rs = Me.Recordset

    If rs.EOF = True Then
    'No records found
    MsgBox "No Warnings needed. No Records found"
    End If

    Dim intCount As Integer
    intCount = rs.RecordCount
    MsgBox "Record Count = " & intCount

    rs.MoveFirst

    'This is where the temporary PDF attachments are generated and then attached to the outgoing EMails

    While Not rs.EOF
    On Error Resume Next

    strFileName = rs![organisationID] & "_Ins_Request.pdf"
    strWhere = "OrganisationID = '" & rs![organisationID] & "'"
    strTo = rs![EmailAddress]
    strSubject = "Insurance details update please"
    strInfo = " Please find attached our annual request for your updated Insurance Certificate of Currency."
    strEndingSalutation = rs![Coordinator Volunter Programs]
    strTitle1 = "Volunteer Resource Centre"
    strNRCG = "Northern Rivers Community Gateway"

    DoCmd.OpenReport "rptInsuranceReminderEmail", acViewPreview, , strWhere
    DoCmd.OutputTo acOutputReport, "rptInsuranceReminderEmail", acFormatPDF, strPath & strFileName
    DoCmd.Close acReport, "rptInsuranceReminderEmail"
    rs.MoveNext

    Dim iCfg As Object
    Dim iMsg As Object


    Set iCfg = CreateObject("CDO.Configuration")

    Set iMsg = CreateObject("CDO.Message")
    With iCfg.Fields

    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserverDNS ' telstra bibpond SMTP server
    ' .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.telstrabusiness.com" ' telstra bibpond SMTP server
    ' or 61.9.168.243

    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0 'anonymous sender

    .Item("http://schemas.microsoft.com/cdo/configuration/sendemailaddress") = sendemailaddress

    .Update

    End With


    With iMsg

    .Configuration = iCfg

    .Subject = strSubject

    .to = strTo
    .TextBody = strInfo & vbCrLf & vbCrLf & strEndingSalutation & vbCrLf & strTitle1 & vbCrLf & strNRCG
    .AddAttachment strPath & strFileName

    .Send

    End With

    Set iMsg = Nothing

    Set iCfg = Nothing


    Wend
    rs.MoveFirst
    Me.cmdEmail.Visible = False
    Set rs = Nothing

    ' Close form frmInsEmailReminderView

    End Sub

    Private Sub cmdCurrentLogFile_Click()

    ' This routine loads and displays the current months log-file for any queries from clients

    Dim rs As DAO.Recordset
    Set rs = Me.RecordsetClone

    Dim fd As Office.FileDialog
    Dim LogFile As Variant
    Dim strDefaultPath As String
    strDefaultPath = rs![DatabaseWorkPath]

    Set fd = Application.FileDialog(msoFileDialogFilePicker)
    With fd
    .InitialFileName = strDefaultPath & "\EmailReminders\Temp"
    .AllowMultiSelect = False
    .InitialView = msoFileDialogViewSmallIcons
    .Filters.Clear
    .Filters.Add "All Files", "*.*"
    .ButtonName = "Check archived Log Files"
    'Set the title of the dialog box.
    .Title = "Please select one of these files"

    If fd.Show = True Then
    LogFile = fd.SelectedItems(1)
    DoCmd.TransferText acImportDelim, , "tblEMailInsuranceLogFileView", LogFile, True
    DoCmd.OpenReport "rptEMailInsuranceLogFileView", acViewReport
    Reports("rptEMailInsuranceLogFileView").Controls(" LogFileName") = LogFile
    ' Here we delete all records that have been temporarily imported into "tblEMailInsuranceLogFileView"
    DoCmd.SetWarnings False
    DoCmd.RunSQL "Delete * From [tblEMailInsuranceLogFileView]"
    DoCmd.SetWarnings True
    End If

    End With

    End Sub

    Private Sub cmdArchivedLogFiles_Click()

    ' This routine loads and displays the user-chosen archived log-file for any queries from clients

    Dim rs As DAO.Recordset

    Dim fd As Office.FileDialog
    Dim dskLogFile As Variant
    Dim rptEMailInsuranceLogFileView As String
    Dim rptLogFileName As String
    Dim LogFileName As String
    Dim strDefaultPath As String
    Set rs = Me.RecordsetClone
    strDefaultPath = rs![DatabaseWorkPath]


    Set fd = Application.FileDialog(msoFileDialogFilePicker)
    With fd
    .InitialFileName = strDefaultPath & "\EmailReminders\OldLogs\"
    .AllowMultiSelect = False
    .InitialView = msoFileDialogViewSmallIcons
    .Filters.Clear
    .Filters.Add "All Files", "*.*"
    .ButtonName = "Check archived Log Files"
    'Set the title of the dialog box.
    .Title = "Please select one of these files"
    ' dskLogFile = fd.SelectedItems(1)

    If fd.Show = True Then
    dskLogFile = fd.SelectedItems(1)
    DoCmd.TransferText acImportDelim, , "tblEMailInsuranceLogFileView", dskLogFile, True
    DoCmd.OpenReport "rptEMailInsuranceLogFileView", acViewReport
    Reports("rptEMailInsuranceLogFileView").Controls(" LogFileName") = dskLogFile
    ' Here we delete all records that have been temporarily imported into "tblEMailInsuranceLogFileView"
    DoCmd.SetWarnings False
    DoCmd.RunSQL "Delete * From [tblEMailInsuranceLogFileView]"
    DoCmd.SetWarnings True
    End If

    End With

    End Sub

    Private Sub cmdClose_Click()
    On Error GoTo Err_Close_Click

    DoCmd.Close

    Exit_Close_Click:
    Exit Sub

    Err_Close_Click:
    Call DisplayRuntimeError
    Resume Exit_Close_Click

    End Sub

    Private Sub Form_Close()
    'After the email and or printed report is complete
    'we issue a Kill command
    'to delete the temp PDF files from ..\EmailReminders\Temp\

    Set rs = Me.RecordsetClone

    Dim strDefaultPath As String
    strDefaultPath = rs![DatabaseWorkPath]
    Dim strDelFile As String
    Dim test As Variable
    On Error Resume Next
    strDelFile = strDefaultPath & "\EmailReminders\Temp\*.pdf"
    test = Dir(strDelFile)
    If Not test = "" Then
    Kill (strDelFile)
    End If
    On Error GoTo 0
    End Sub

    Since today is my last day here, I will no longer be available on this 'moniker'.

    Thanks again.

    Kind regards

    Alex

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 06-26-2013, 08:28 AM
  2. Replies: 1
    Last Post: 07-26-2011, 06:10 AM
  3. Replies: 4
    Last Post: 04-13-2011, 10:11 AM
  4. Report pages
    By combine21 in forum Reports
    Replies: 1
    Last Post: 03-05-2011, 04:39 PM
  5. Blank pages between report pages
    By jonsuns7 in forum Reports
    Replies: 2
    Last Post: 10-01-2009, 05:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums