[AccessD] Docmd.SendObject

Max Wanadoo max.wanadoo at gmail.com
Thu May 1 14:53:18 CDT 2008


Mark, different style of programming.  This would be my version of it.

Function SendEmail()
  Dim dbs As dao.Database, rst As dao.Recordset
  Dim strBody As String
  Set dbs = CurrentDb
  Set rst = dbs.OpenRecordset("tblStock")
  If rst.EOF Then
    MsgBox "No records to email"
  Else
    rst.movefirst
    Do While Not rst.EOF
      strBody = strBody & vbCrLf & rst!Stock & ":" & rst!PerChange & " "
      rst.MoveNext
    Loop
    DoCmd.SendObject , , acFormatHTML, "5555555555 at messaging.sprintpcs.com",
"6666666666 at messaging.sprintpcs.com", , "Stock", strBody, false
  End If
exithere:
  Set dbs = Nothing: Set rst = Nothing
  Exit Function
End Function

Cannot find anything intrinsically wrong with yours, but these changes may
have subtle implications.
I also like to explicitly declare everything.

Max

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte
Sent: Thursday, May 01, 2008 6:02 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Docmd.SendObject


Here is the email function...it steps right through as if everything is
OK...bot No email gets sent on the SendObject...and no errors either.

**********************************
    Dim dbs As Database, rst As Recordset, intI As Integer, FirstCount As
Integer
    
    Dim Stock
    Dim StockPercent
    Dim Body
    Dim strNumber As String
        Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("My SQL Statement here")

        FirstCount = rst.RecordCount
        rst.MoveLast
        rst.MoveFirst
    For intI = 1 To rst.RecordCount
     Stock = rst!symbol
     StockPercent = rst!PerChange
    Body = Body & Stock & ":" & StockPercent & " "
        rst.MoveNext
        
        Next intI

         rst.Close

    Set dbs = Nothing

DoCmd.SendObject , , acFormatHTML, "5555555555 at messaging.sprintpcs.com",
"6666666666 at messaging.sprintpcs.com", , "Stock", Body, 0

**********************************


> From: dwaters at usinternet.com
> To: accessd at databaseadvisors.com
> Date: Thu, 1 May 2008 11:04:55 -0500
> Subject: Re: [AccessD] Docmd.SendObject
>
> Mark - can you post some of your code and show which line(s) get 
> skipped when you are stepping through?
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A 
> Matte
> Sent: Thursday, May 01, 2008 7:40 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Docmd.SendObject
>
>
> Thanks Max,
>
> But ...No. I think It has something to do with the checking for the 
> FTP and not finding one(or some code in between). If it does not find 
> a file...it never gets to the email part...so I'm not sure where it would
impact.
>
> Currently If I run just the email part...runs fine...over and over 
> again...but if I let it step through the FTP and other stuff...it will 
> run if it finds a file...if no file...I can not even run just the email
part.
> It steps through as if everything is OK...just no email. There is 
> error handling, but NO error?
>
> Thanks,
>
> Mark A. Matte
>
>
>
>
>
>> From: max.wanadoo at gmail.com
>> To: accessd at databaseadvisors.com
>> Date: Thu, 1 May 2008 07:26:15 +0100
>> Subject: Re: [AccessD] Docmd.SendObject
>>
>> Is the PC set to Hibernate perhaps?
>> Just guessing really.
>> Max
>>
>>
>> -----Original Message-----
>> From: accessd-bounces at databaseadvisors.com
>> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A 
>> Matte
>> Sent: Thursday, May 01, 2008 2:06 AM
>> To: Access Developers discussion and problem solving
>> Subject: [AccessD] Docmd.SendObject
>>
>>
>> Hello All,
>>
>> I have an MDB that does some FTP,Unzip,Import, and email.
>>
>> Its been running a few years...but recently put it on a newer 
>> machine...running 2000 Server...A2K.
>>
>> All of the functionality still works...at first...
>>
>> It is using a form timer to check for a file...and when it finds 
>> 1...it
> does
>> all the other stuff.
>>
>> Problem is after an hour or so...it stops sending email. It does not 
>> error...if I go and step through the whole thing...or just the email 
>> part...it just steps right over the docmd.sendobject without 
>> erroring. If
> I
>> reopen the mdb...it runs fine for a bit...b ut same issue comes up?
>>
>>
>> Any ideas?
>>
>> Thanks,
>>
>> Mark A. Matte
>> _________________________________________________________________
>> In a rush? Get real-time answers with Windows Live Messenger.
>>
> http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_R
> efresh
>> _realtime_042008
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>
> _________________________________________________________________
> Back to work after baby-how do you know when you're ready?
> http://lifestyle.msn.com/familyandparenting/articleNW.aspx?cp-document
> id=579
> 7498&ocid=T067MSN40A0701A
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com

_________________________________________________________________
Spell a grand slam in this game where word skill meets World Series. Get in
the game.
http://club.live.com/word_slugger.aspx?icid=word_slugger_wlhm_admod_april08
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list