Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SendObj works only once

Status
Not open for further replies.

Smarty

Programmer
Apr 12, 2001
191
BE
Hi,

I have the following code:

Code:
On Error GoTo fout
  Dim varTo, varFrom, varSubject, varBody As String
  Dim sqlstring As String
  Dim tmpsessionid As String
    
  sqlstring = "select * from dbo_CONTACT where COCONTACTid = " & Me.CACONTACT
  Dim db As Variant, rst, rst2 As Recordset
  Dim Value1
  Debug.Print sqlstring
    
  Set db = CurrentDb
  Set rst = db.openrecordset(sqlstring)
  varTo = rst![COEMAIL]
   
  varSubject = "xCA.Support S" & CACALLID & ": " & CATITLE

  If rst![COLANG] = "NL" Then
    varBody = "Beste " 
  End If
  Debug.Print varBody
  DoCmd.SendObject acSendNoObject, , , varTo, , , varSubject, varBody
Exit Sub
  fout: MsgBox "Mail werd niet verstuurd"
End Sub
But the line with DoCmd does only opens a mailmessage the first time. If I do it once, I need to close the database and open it again to get another email message.

Any1 an idea of what is going wrong here?
 
This is a shot in the dark - but do you need to remove the Debug.Print statements?
 
I removed the debug.prints, but as might be expected this didn't change my problem.

Thanx for the thought anyway!
 
Is it possible that it reminds a state or something?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top