DoCmd.SendObject only working once

  • Thread starter zwanz P via AccessMonster.com
  • Start date
Z

zwanz P via AccessMonster.com

hey guys,

i got a problem with the DoCmd.SendObject command

i got a form with the following code

My form: KASPERgelebriefjeform

Private Sub Knop37_Click()

DoCmd.OpenReport "KASPER - gelebriefjerapport", acViewPreview

End Sub


My report: KASPER - gelebriefjerapport

Private Sub Report_Activate()

Tekst0 = Forms!KASPERgelebriefjeform.Tekst0
Tekst2 = Forms!KASPERgelebriefjeform.Tekst2
Tekst4 = Forms!KASPERgelebriefjeform.Tekst4
Tekst6 = Forms!KASPERgelebriefjeform.Tekst6
Tekst8 = Forms!KASPERgelebriefjeform.Tekst8
Tekst10 = Forms!KASPERgelebriefjeform.Tekst10
Selectievakje28 = Forms!KASPERgelebriefjeform.Selectievakje28
Selectievakje30 = Forms!KASPERgelebriefjeform.Selectievakje30
Selectievakje32 = Forms!KASPERgelebriefjeform.Selectievakje32
Selectievakje34 = Forms!KASPERgelebriefjeform.Selectievakje34

Dim strMessage2 As String

strMessage2 = "Wij hebben u niet aangetroffen op uw werkplek (zie bijlage)." & vbLf & vbLf & "Voor eventuele vragen kunt contact met ons op nemen." & vbLf & _
"Vermeld svp het ticketnummer." & vbLf & vbLf & vbLf & _
"Met vriendelijke groeten," & vbLf & vbLf & _
"Afdeling Automatisering" & vbLf & vbLf & _
"tel 026 -378 6666" & vbLf & "(e-mail address removed)"


DoCmd.SendObject acSendReport, "KASPER - gelebriefjerapport", acFormatSNP, "Hier e-mail invoeren", , , "Helpdesk I&A: Afwezigheid werkplek", strMessage2
DoCmd.Close acReport, "KASPER - gelebriefjerapport"

End Sub

The first time i click the button on my form, its working but the second time i try it wont open outlook anymore. It still activates the report the second time couse when i delete the DoCmd.close on the report its opening so activation is not the problem. its just that it wont start the sendobject code after the first time. I have to restart my database and then its working again for 1 time, but when i click the second time it wont open outlook. Whats the problem? :"(

excuse me, my english is kinda poor :blush:
 
B

Bas Cost Budde

zwanz said:
Tekst0 = Forms!KASPERgelebriefjeform.Tekst0

how about assigning meaningfull names to your controls? :)
Selectievakje28 = Forms!KASPERgelebriefjeform.Selectievakje28

Lekker je moederstaal prijsgeven...
"tel 026 -378 6666" & vbLf & "(e-mail address removed)"
Arnhem?

DoCmd.SendObject acSendReport, "KASPER - gelebriefjerapport", acFormatSNP, "Hier e-mail invoeren", , , "Helpdesk I&A: Afwezigheid werkplek", strMessage2
DoCmd.Close acReport, "KASPER - gelebriefjerapport"

I don't think you need to do the close. Or did the code open the report
as well as send it? Oh yes, it does. That is: you do this from the
Activate event. Hm, okay.
The first time i click the button on my form, its working but the second time i try it wont open outlook anymore. It still activates the report the second time couse when i delete the DoCmd.close on the report its opening so activation is not the problem. its just that it wont start the sendobject code after the first time. I have to restart my database and then its working again for 1 time, but when i click the second time it wont open outlook. Whats the problem? :"(

Are you sure Outlook is finished sending it? As you do it, you don't
supply the False for the EditMessage parameter for SendObject; that
leaves the message open.
excuse me, my english is kinda poor :blush:

As is with many of us, not excluding native speakers :)
 
Z

zwanz P via AccessMonster.com

haha, ook nl ;)

What exactly do u mean with this?
"Are you sure Outlook is finished sending it? As you do it, you don't
supply the False for the EditMessage parameter for SendObject; that
leaves the message open."

when outlook opens the first time, i dont send the email, just click exit the outlook mail message and try again... is it needed to send the message?

mayb u can give me your mail/msn so we can chat ;)
op zn hollands, dan begrijp ik het wat beter ;D
 
B

Bas Cost Budde

zwanz said:
haha, ook nl ;)

What exactly do u mean with this?
"Are you sure Outlook is finished sending it? As you do it, you don't
supply the False for the EditMessage parameter for SendObject; that
leaves the message open."

when outlook opens the first time, i dont send the email, just click
exit the outlook mail message and try again... is it needed
to send the message?

As long as Outlook was closed, the second invocation should not present
you with problems. It was my guess that an instance of Outlook would
remain open, maybe in the background; there could be a timing issue.

My mailadress has been spam-protected, use the cryptical hint in my sig
 
Top