Send Object twice?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I use "DoCmd.SendObject acSendNoObject, , , strName, , ,
strSubject, txtmsg, True" to send an e-mail message. A lot
of If Thens/Select Cases etc. are used to create the
subject and msg. If I need to immediatly send another
message, it does not work. It will go through all the code
to create everything and give me my message box after the
Send but it doesn't do the Send. I have to close my
database and Access and reopen before it will send again.

I created a sample SendObject that works repeatedly so I
guess it's something in that code but I can't imagine what
would affect the sending.

Anybody every have this situation?

Rick
 
I can't say I've seen this before, but it would be helpful to have the code
so we can see what might be causing the behavior... Try posting the code
back and we can take a look.
 
I have the same problem, I use the sendObject twice, It
only send mail the first time.
I use this code:

'----------------------------------------------------------
--
' MailOrdersEnschedeXLS1
'
'----------------------------------------------------------
--
Function MailOrdersEnschedeXLS1(VanFaktuur, TotFaktuur As
String)
On Error GoTo MailOrdersEnschedeXLS1_Err

'Dim
Dim Naam_Bestand, Naam_map As String
Dim NaamSubject, NaamEmail, NaamQuery, NaamText As
String
Dim ExcelSheet As Object

'gegevens uit formulier Selectie_orders overnemen
VanFaktuur = Forms![Selectie_orders]![van_faktuur]
TotFaktuur = Forms![Selectie_orders]![tot_faktuur]

'E-mail maken
Naam_map = "C:\Berging-v2004\Data\enschede\"
Naam_Bestand = ".xls"

'Mail adres
NaamEmail = "(e-mail address removed)"

'Naam Query
NaamQuery = "Qry_Orders_E"

'Subject
NaamSubject = "Orders Enschede nr " + (Left
(VanFaktuur, 6)) + "_" + (Right(VanFaktuur, 4)) _
+ " t/m " + (Left(TotFaktuur, 6))
+ "_" + (Right(TotFaktuur, 4))

'Mail Text
NaamText = NaamSubject + " in Bestand: " + NaamQuery +
Naam_Bestand + _
vbCrLf + " Bijlage opslaan in : " +
Naam_map + _
vbCrLf + " Dit bericht wordt gevolgd door
een tweede bericht met de ORDERREGELS "

'Send Query Orders Enschede
DoCmd.SendObject acSendQuery, NaamQuery, acFormatXLS,
NaamEmail, "(e-mail address removed)", , NaamSubject, NaamText, False

MsgBox Prompt:=" Orders naar Borne ge-maild ", _
Title:="Orders Enschede ", _
Buttons:=vbExclamation

'Naam Query Voor Orderregels
NaamQuery = "Qry_OrderRegels_E"

'Subject
NaamSubject = "Orderregels Enschede nr " + (Left
(VanFaktuur, 6)) + "_" + (Right(VanFaktuur, 4)) _
+ " t/m " + (Left(TotFaktuur, 6))
+ "_" + (Right(TotFaktuur, 4))

'Mail Text
NaamText = NaamSubject + " in Bestand: " + NaamQuery +
Naam_Bestand + _
vbCrLf + " Bijlage opslaan in : " +
Naam_map + _
vbCrLf + " Als Deze Bijlage en de vorige
zijn opgeslagen in " + _
vbCrLf + Naam_map + " Dan in Berging 2004
uitvoeren: Inlezen Orders Enschede "

'Send Query Orderregels Enschede
DoCmd.SendObject acSendQuery, NaamQuery, acFormatXLS,
NaamEmail, "(e-mail address removed)", , NaamSubject, NaamText, False

'Set status = 4 , ascii export file is gemaakt, naar
Borne
'Call UpdateStatusOrder(VanFaktuur, TotFaktuur, 4)

MsgBox Prompt:=" OrderRegels naar Borne ge-maild ", _
Title:="Orders Enschede ", _
Buttons:=vbExclamation


MailOrdersEnschedeXLS1_Exit:
Exit Function

MailOrdersEnschedeXLS1_Err:
MsgBox Error$
Resume MailOrdersEnschedeXLS1_Exit

End Function
 
I use "DoCmd.SendObject acSendNoObject, , , strName, , ,
strSubject, txtmsg, True" to send an e-mail message. A lot
of If Thens/Select Cases etc. are used to create the
subject and msg. If I need to immediatly send another
message, it does not work. It will go through all the code
to create everything and give me my message box after the
Send but it doesn't do the Send. I have to close my
database and Access and reopen before it will send again.

I created a sample SendObject that works repeatedly so I
guess it's something in that code but I can't imagine what
would affect the sending.

Anybody every have this situation?

Rick

What version and service-level of Access? It seems to me there was a
bug in SendObject in the initial release of Access 2000. Yes, here it
is:


http://support.microsoft.com/default.aspx?scid=kb;en-us;260819&Product=acc2000
ACC2000: SendObject Method Fails in Access 2000

I believe it is supposed to have been fixed with Office 2000 SP3.\
 
Thank you Dirk. Good detective work. I'm glad I read your message before I
went digging myself, saved me a bunch of time :)
 
Back
Top