From: Douglas J. Steele on
You've commented out the .Send command.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Bob Vance" <rjvance(a)ihug.co.nz> wrote in message
news:uyK1eQl6KHA.1424(a)TK2MSFTNGP04.phx.gbl...
>
> "David W. Fenton" <XXXusenet(a)dfenton.com.invalid> wrote in message
> news:Xns9D6CABF724C46f99a49ed1d0c49c5bbb2(a)74.209.136.93...
>> "Bob Vance" <rjvance(a)ihug.co.nz> wrote in
>> news:egmngtZ6KHA.3184(a)TK2MSFTNGP05.phx.gbl:
>>
>>> The Highlighted row was:
>>> Set myout = CreateObject(Outlook.Application, "localhost")
>>
>> As you reported earlier, the error was:
>>
>>>> Error Number 463
>>>> Description: Class not registered on local machine
>>
>> Doug suggested you try removing the "localhost" (it shouldn't make a
>> difference, as that's the default, but if you leave it out, it can
>> be blocked by some security software).
>>
>> The message is not believable, given that you had previously used
>> early binding, with a reference to Outlook, right?
>>
>> Try repairing your Office installation and trying again.
>>
>> Also, did you fix the olMailItem problem? The line of code
>> immediately after the offending line in the code you posted has a
>> reference to that constant, which will be undefined without the
>> reference (unless you redefined it yourself). I know it's not the
>> highlighted line, but it's worth a try. Of course, it should give
>> you a compile error instead of a runtime error. You *do* compile
>> your code, right?
>>
>> --
>> David W. Fenton http://www.dfenton.com/
>> usenet at dfenton dot com http://www.dfenton.com/DFA/
>
> Thanks David, I am not getting any error messages and my 2 reports are
> going to my Local Directory but not going to Outlook!
>
> Private Sub SendMailButton_Click()
>
> 'On Error GoTo ErrorHandler
> If Me.Dirty = True Then
> Me.Dirty = False
> Dim myfile1 As String, myfile2 As String
> End If
> Dim mydir As String
> mydir = Left(CurrentDb.Name, Len(CurrentDb.Name) -
> Len(Dir(CurrentDb.Name)))
> Dim lngID As Long, strMail As String, strBodyMsg As String, _
> blEditMail As Boolean, sndReport As String, strCompany As String
> Dim msgPmt As String, msgBtns As Integer, msgTitle As String, msgResp
> As Integer, tbAmount As String
> Dim strFormat As String
> Dim mytot As Long
> mytot = DCount("[InvoiceID]", "qrySelInvoices", "")
>
> Select Case Me.tbEmailOption.value
>
> Case "ADOBE"
> strFormat = acFormatPDF
> myfile1 = mydir & "Statement.pdf"
> myfile2 = mydir & "Invoice.pdf"
> Case "WORD"
> strFormat = acFormatRTF
> myfile1 = mydir & "Statement.rtf"
> myfile2 = mydir & "Invoice.rtf"
>
> Case "SNAPSHOT"
> strFormat = acFormatSNP
> myfile1 = mydir & "Statement.SNP"
> myfile2 = mydir & "Invoice.SNP"
>
> Case "TEXT"
> strFormat = acFormatTXT
> myfile1 = mydir & "Statement.txt"
> myfile2 = mydir & "Invoice.txt"
>
> Case "HTML"
> strFormat = acFormatHTML
> myfile1 = mydir & "Statement.htm"
> myfile2 = mydir & "Invoice.htm"
>
> Case Else ' catch all others
> strFormat = acFormatHTML
> myfile1 = mydir & "Statement.htm"
> myfile2 = mydir & "Invoice.htm"
>
> End Select
>
> Select Case Me.OpenArgs
>
> Case "OwnerStatement"
>
> sndReport = "rptOwnerPaymentMethod"
>
>
> lngID = Nz(Me.cbOwnerName.Column(0), 0)
> strMail = OwnerEmailAddress(lngID)
> tbAmount = Nz(Me.cbOwnerName.Column(5), 0)
>
> strBodyMsg = "To: "
> strBodyMsg = strBodyMsg & Nz(DLookup("[ClientTitle]",
> "tblOwnerInfo", _
> "[OwnerID]=" & lngID), " ") & " "
> strBodyMsg = strBodyMsg & Nz(DLookup("[OwnerLastName]",
> "tblOwnerInfo", _
> "[OwnerID]=" & lngID), " Owner")
> strBodyMsg = strBodyMsg & "," & Chr(10) & Chr(10) & Chr(13) _
> & "Please find attached your Statement, Dated:" & " " &
> Format(Date, "d-mmm-yyyy") & Chr(10) & "Your Statement Total: " &
> Format(tbAmount, "$ #,##.00") & Chr(10) & Chr(10) &
> Nz(DLookup("[EmailMessage]", "tblCompanyInfo"), "") & eMailSignature("Best
> Regards", True) & Chr(10) & Chr(10) & DownloadMessage("PDF") _
>
>
> DoCmd.OutputTo acOutputReport, sndReport, strFormat,
> myfile1, False
> If mytot > 0 Then
> DoCmd.OutputTo acOutputReport, "rptInvoiceModify",
> strFormat, myfile2, False
> End If
>
> CurrentDb.Execute "UPDATE tblOwnerInfo " & _
> "SET EmailDateState = Now() " & _
> "WHERE OwnerID = " & lngID, dbFailOnError
> Dim myitem As Object
> Dim myout As Object
> 'Set myout = CreateObject("Outlook.Application", "localhost")
> Set myout = CreateObject("Outlook.Application")
> 'Set myitem = myout.CreateItem(olMailItem)
> Set myitem = myout.CreateItem(0)
>
> With myitem
> .To = strMail
> .CC = Nz(DLookup("EmailCC", "tblOwnerInfo", "OwnerID = " & lngID), "")
> .Bcc = Nz(DLookup("EmailBCC", "tblOwnerInfo", "OwnerID = " & lngID),
> "")
> .Subject = "Your Statement" & " / " & Nz(DLookup("[CompanyName]",
> "tblCompanyInfo"))
> .Body = strBodyMsg 'EditMessage:=blEditMail
> .Attachments.Add myfile1
> If mytot > 0 Then
> .Attachments.Add myfile2
> End If
> 'On Error Resume Next
> '.Send
> 'On Error GoTo ErrorHandler
> End With
> Set myitem = Nothing
> Set myout = Nothing
> cbOwnerName.SetFocus
>
> Case Else
> Exit Sub
>
> End Select
> ExitProc:
> Exit Sub
> 'ErrorHandler:
>
> 'msgTitle = "Untrapped Error"
> 'msgBtns = vbExclamation
>
> 'Select Case Err.Number
> 'User cancelled message (2293 & 2296 are raised
> 'by Outlook, not Outlook Express).
> ' Case 2501, 2293, 2296
> ' Case Else
> ' MsgBox "Error Number: " & Err.Number & Chr(13) _
> ' & "Description: " & Err.Description & Chr(13) & Chr(13) _
> ' & "(frmBillStatement SendMailButton_Click)", msgBtns, msgTitle
> ' End Select
>
> ' Resume ExitProc
>
> End Sub
>


From: Bob Vance on
Thanks Douglas, Thats a good reason why it would not send :)
Thank you very much for your help much appreciated, all good now
Regards Bob

"Douglas J. Steele" <NOSPAM_djsteele(a)NOSPAM_gmail.com> wrote in message
news:ulTz0Iw6KHA.356(a)TK2MSFTNGP05.phx.gbl...
> You've commented out the .Send command.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "Bob Vance" <rjvance(a)ihug.co.nz> wrote in message
> news:uyK1eQl6KHA.1424(a)TK2MSFTNGP04.phx.gbl...
>>
>> "David W. Fenton" <XXXusenet(a)dfenton.com.invalid> wrote in message
>> news:Xns9D6CABF724C46f99a49ed1d0c49c5bbb2(a)74.209.136.93...
>>> "Bob Vance" <rjvance(a)ihug.co.nz> wrote in
>>> news:egmngtZ6KHA.3184(a)TK2MSFTNGP05.phx.gbl:
>>>
>>>> The Highlighted row was:
>>>> Set myout = CreateObject(Outlook.Application, "localhost")
>>>
>>> As you reported earlier, the error was:
>>>
>>>>> Error Number 463
>>>>> Description: Class not registered on local machine
>>>
>>> Doug suggested you try removing the "localhost" (it shouldn't make a
>>> difference, as that's the default, but if you leave it out, it can
>>> be blocked by some security software).
>>>
>>> The message is not believable, given that you had previously used
>>> early binding, with a reference to Outlook, right?
>>>
>>> Try repairing your Office installation and trying again.
>>>
>>> Also, did you fix the olMailItem problem? The line of code
>>> immediately after the offending line in the code you posted has a
>>> reference to that constant, which will be undefined without the
>>> reference (unless you redefined it yourself). I know it's not the
>>> highlighted line, but it's worth a try. Of course, it should give
>>> you a compile error instead of a runtime error. You *do* compile
>>> your code, right?
>>>
>>> --
>>> David W. Fenton http://www.dfenton.com/
>>> usenet at dfenton dot com http://www.dfenton.com/DFA/
>>
>> Thanks David, I am not getting any error messages and my 2 reports are
>> going to my Local Directory but not going to Outlook!
>>
>> Private Sub SendMailButton_Click()
>>
>> 'On Error GoTo ErrorHandler
>> If Me.Dirty = True Then
>> Me.Dirty = False
>> Dim myfile1 As String, myfile2 As String
>> End If
>> Dim mydir As String
>> mydir = Left(CurrentDb.Name, Len(CurrentDb.Name) -
>> Len(Dir(CurrentDb.Name)))
>> Dim lngID As Long, strMail As String, strBodyMsg As String, _
>> blEditMail As Boolean, sndReport As String, strCompany As String
>> Dim msgPmt As String, msgBtns As Integer, msgTitle As String, msgResp
>> As Integer, tbAmount As String
>> Dim strFormat As String
>> Dim mytot As Long
>> mytot = DCount("[InvoiceID]", "qrySelInvoices", "")
>>
>> Select Case Me.tbEmailOption.value
>>
>> Case "ADOBE"
>> strFormat = acFormatPDF
>> myfile1 = mydir & "Statement.pdf"
>> myfile2 = mydir & "Invoice.pdf"
>> Case "WORD"
>> strFormat = acFormatRTF
>> myfile1 = mydir & "Statement.rtf"
>> myfile2 = mydir & "Invoice.rtf"
>>
>> Case "SNAPSHOT"
>> strFormat = acFormatSNP
>> myfile1 = mydir & "Statement.SNP"
>> myfile2 = mydir & "Invoice.SNP"
>>
>> Case "TEXT"
>> strFormat = acFormatTXT
>> myfile1 = mydir & "Statement.txt"
>> myfile2 = mydir & "Invoice.txt"
>>
>> Case "HTML"
>> strFormat = acFormatHTML
>> myfile1 = mydir & "Statement.htm"
>> myfile2 = mydir & "Invoice.htm"
>>
>> Case Else ' catch all others
>> strFormat = acFormatHTML
>> myfile1 = mydir & "Statement.htm"
>> myfile2 = mydir & "Invoice.htm"
>>
>> End Select
>>
>> Select Case Me.OpenArgs
>>
>> Case "OwnerStatement"
>>
>> sndReport = "rptOwnerPaymentMethod"
>>
>>
>> lngID = Nz(Me.cbOwnerName.Column(0), 0)
>> strMail = OwnerEmailAddress(lngID)
>> tbAmount = Nz(Me.cbOwnerName.Column(5), 0)
>>
>> strBodyMsg = "To: "
>> strBodyMsg = strBodyMsg & Nz(DLookup("[ClientTitle]",
>> "tblOwnerInfo", _
>> "[OwnerID]=" & lngID), " ") & " "
>> strBodyMsg = strBodyMsg & Nz(DLookup("[OwnerLastName]",
>> "tblOwnerInfo", _
>> "[OwnerID]=" & lngID), " Owner")
>> strBodyMsg = strBodyMsg & "," & Chr(10) & Chr(10) & Chr(13) _
>> & "Please find attached your Statement, Dated:" & " " &
>> Format(Date, "d-mmm-yyyy") & Chr(10) & "Your Statement Total: " &
>> Format(tbAmount, "$ #,##.00") & Chr(10) & Chr(10) &
>> Nz(DLookup("[EmailMessage]", "tblCompanyInfo"), "") &
>> eMailSignature("Best Regards", True) & Chr(10) & Chr(10) &
>> DownloadMessage("PDF") _
>>
>>
>> DoCmd.OutputTo acOutputReport, sndReport, strFormat,
>> myfile1, False
>> If mytot > 0 Then
>> DoCmd.OutputTo acOutputReport, "rptInvoiceModify",
>> strFormat, myfile2, False
>> End If
>>
>> CurrentDb.Execute "UPDATE tblOwnerInfo " & _
>> "SET EmailDateState = Now() " & _
>> "WHERE OwnerID = " & lngID, dbFailOnError
>> Dim myitem As Object
>> Dim myout As Object
>> 'Set myout = CreateObject("Outlook.Application", "localhost")
>> Set myout = CreateObject("Outlook.Application")
>> 'Set myitem = myout.CreateItem(olMailItem)
>> Set myitem = myout.CreateItem(0)
>>
>> With myitem
>> .To = strMail
>> .CC = Nz(DLookup("EmailCC", "tblOwnerInfo", "OwnerID = " & lngID), "")
>> .Bcc = Nz(DLookup("EmailBCC", "tblOwnerInfo", "OwnerID = " & lngID),
>> "")
>> .Subject = "Your Statement" & " / " & Nz(DLookup("[CompanyName]",
>> "tblCompanyInfo"))
>> .Body = strBodyMsg 'EditMessage:=blEditMail
>> .Attachments.Add myfile1
>> If mytot > 0 Then
>> .Attachments.Add myfile2
>> End If
>> 'On Error Resume Next
>> '.Send
>> 'On Error GoTo ErrorHandler
>> End With
>> Set myitem = Nothing
>> Set myout = Nothing
>> cbOwnerName.SetFocus
>>
>> Case Else
>> Exit Sub
>>
>> End Select
>> ExitProc:
>> Exit Sub
>> 'ErrorHandler:
>>
>> 'msgTitle = "Untrapped Error"
>> 'msgBtns = vbExclamation
>>
>> 'Select Case Err.Number
>> 'User cancelled message (2293 & 2296 are raised
>> 'by Outlook, not Outlook Express).
>> ' Case 2501, 2293, 2296
>> ' Case Else
>> ' MsgBox "Error Number: " & Err.Number & Chr(13) _
>> ' & "Description: " & Err.Description & Chr(13) & Chr(13) _
>> ' & "(frmBillStatement SendMailButton_Click)", msgBtns,
>> msgTitle
>> ' End Select
>>
>> ' Resume ExitProc
>>
>> End Sub
>>
>
>


From: Bob Vance on

"Bob Vance" <rjvance(a)ihug.co.nz> wrote in message
news:%23BX$M1x6KHA.2240(a)TK2MSFTNGP06.phx.gbl...
> Thanks Douglas, Thats a good reason why it would not send :)
> Thank you very much for your help much appreciated, all good now
> Regards Bob
>
> "Douglas J. Steele" <NOSPAM_djsteele(a)NOSPAM_gmail.com> wrote in message
> news:ulTz0Iw6KHA.356(a)TK2MSFTNGP05.phx.gbl...

One More thing should I keep all my 7 References?........Regards Bob

Visual Basic For Application
Microsoft Access 12.0 Object Library
OLE Automation
Microsoft ActiveX Data Objects 2.1 Library
Microsoft Visual Basic for Application Extensilbilty 5.3
Microsoft Outlook 12 Object Library
Microsoft Office 12.0 Access database engine Object Library


From: Douglas J. Steele on
I believe David & I both suggested that you should only require 3
references:

- Visual Basic For Application
- Microsoft Access 12.0 Object Library
- Microsoft Office 12.0 Access database engine Object Library

A large part of this thread involved getting late binding to work with
Outlook so that you could remove the reference to Microsoft Outlook 12
Object Library.

We both suggested you use DAO rather than ADO, in which case the reference
to Microsoft ActiveX Data Objects 2.1 Library won't be required.

There's seldom a reason for a reference to either OLE Automation or
Microsoft Visual Basic for Application Extensilbilty 5.3


--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"Bob Vance" <rjvance(a)ihug.co.nz> wrote in message
news:eTcF9ID7KHA.5412(a)TK2MSFTNGP06.phx.gbl...
> One More thing should I keep all my 7 References?........Regards Bob
>
> Visual Basic For Application
> Microsoft Access 12.0 Object Library
> OLE Automation
> Microsoft ActiveX Data Objects 2.1 Library
> Microsoft Visual Basic for Application Extensilbilty 5.3
> Microsoft Outlook 12 Object Library
> Microsoft Office 12.0 Access database engine Object Library
>
>


From: David W. Fenton on
"Bob Vance" <rjvance(a)ihug.co.nz> wrote in
news:OK4Oo6H7KHA.5848(a)TK2MSFTNGP06.phx.gbl:

> So now I must re code my funGetHorse as its ADODB?

There is nothing in either of those functions that depends on any
functionality of ADO that is unique to ADO. Why did you implement it
in ADO instead of just keeping with DAO?

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9
Prev: Icons in tab pages
Next: Save Button