Propert or method of the OLE object

jasn_78

Registered User.
Local time
Today, 15:03
Joined
Aug 1, 2001
Messages
214
I have written the below code which access a query to obtain a list of email address and a certain store for those email addresses as the criteria for my report then automatically emails this report to those users.

When I run this on my computer everything works perfectly but i have since installed this on a clients pc and it gives me the error message in the TITLE

Any ideas would be great

Here is the code that is used.

Code:
Private Sub cmdVIEW_Click()
Dim strrpt As String
Dim strwhere As String
Dim today As String

today = Format(Now(), "ddmmyy")

If Me.frameREPORT = 4 Then
    DoCmd.Close
    Call AUTOTILLTOTALS
End If

End Sub

Public Function AUTOTILLTOTALS()
Dim rsemail As DAO.Recordset
Dim stremail As String
Dim strstore As String
Dim strsmtp As String
Dim strfrom As String

Set rsemail = CurrentDb.OpenRecordset("qryEMAILS")

Do While Not rsemail.EOF
stremail = rsemail.Fields("TO").Value
strstore = rsemail.Fields("STORE").Value
strsmtp = rsemail.Fields("SMTP").Value
strfrom = rsemail.Fields("FROM").Value
Call report_autoemail("rptTILLTOTALS", "TILL TOTALS", stremail, strfrom, strsmtp, strstore)
rsemail.MoveNext
Loop
    
End Function

Public Sub report_autoemail(strrpt As String, _
                            subject As String, strtoemail As String, _
                            strfromemail As String, _
                            strsmtp As String, strstore As String)
Dim today As String
Dim objMessage As Object
Dim sendto As String
Dim stwhere As String

today = Format(Now(), "ddmmyy")
stwhere = "STORE LIKE " & strstore

        'this option outputs the report to a pdf document then emails it to certain email addresses
        Set objMessage = CreateObject("CDO.Message")
        objMessage.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        objMessage.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strsmtp
        objMessage.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        objMessage.Configuration.Fields.Update
        objMessage.subject = subject
        sendto = strtoemail
        objMessage.from = strfromemail
        objMessage.to = sendto
        objMessage.Bcc = ""
        objMessage.CC = ""
        objMessage.TextBody = "TFRS CUSTOM REPORTS"
        DoCmd.OpenReport strrpt, acViewPreview, , stwhere
        DoCmd.OutputTo acOutputReport, strrpt, acFormatPDF, "C:\TFRS REPORTS\" & strrpt & today & ".PDF"
        objMessage.AddAttachment "C:\TFRS REPORTS\" & strrpt & today & ".PDF"
        objMessage.Send
        DoCmd.Close

End Sub

Thanks in Advance
 
Stupid DBA :(

Nermind guys found the problem.
Note to self or others. It is a pain in the ar$e working on a database someone else developed and you arent allowed to modify :(
 

Users who are viewing this thread

Back
Top Bottom