Hi all,
I have constructed some code that takes data out of a query based on an open form
the data is put into the body of an email and is send
now this is what i wont get to work :
the person who receives the email needs to add or change the
data in the email body so he can send the email back with the
right data
i cant seem to find any solution to make this work, the
data in the email body is read only
this is my code, anyone any ideas on this one :
Private Sub Command33_Click()
On Error GoTo Err_Command33_Click
DoCmd.Echo False 'switch echo off so query is not displayed
DoCmd.OpenQuery "Query : Aanvraag CC", acNormal, acEdit 'open the query to get the email value
DoCmd.Close acQuery, "Query : Aanvraag CC", acSaveNo 'close query
DoCmd.Echo True 'switch echo back on
stKlantId = DLookup("[Klant ID]", "Query : Aanvraag CC")
stNaam = DLookup("[Naam]", "Query : Aanvraag CC")
stAdres = DLookup("[Adres]", "Query : Aanvraag CC")
stWoonplaats = DLookup("[Woonplaats]", "Query : Aanvraag CC")
stPostcode = DLookup("[Postcode]", "Query : Aanvraag CC")
stStartdatum = DLookup("[Startdatum]", "Query : Aanvraag CC")
stExpr1 = DLookup("[Expr1]", "Query : Aanvraag CC")
stCreditC = DLookup("[Credit check]", "Query : Aanvraag CC")
stOpmerk = DLookup("[Opmerkingen]", "Query : Aanvraag CC")
stNassC = DLookup("[Nassubel Code]", "Query : Aanvraag CC")
stBTWnr = DLookup("[BTW nr]", "Query : Aanvraag CC")
Dim myApp As New Outlook.Application
Dim myItem As Outlook.MailItem
Set myItem = myApp.CreateItem(olMailItem)
With myItem.BodyFormat
.Importance = 2
.To = "email address"
.Subject = "Automated Credit Check"
.ReadReceiptRequested = False
.Body = "Credit Check aub :" & vbCr & _
"Klant ID : " & stKlantId & vbCr & _
"Naam : " & stNaam & vbCr & _
"BTW nr : " & stBTWnr & vbCr & _
"Adres : " & stAdres & vbCr & _
"Woonplaats : " & stWoonplaats & vbCr & _
"Postcode : " & stPostcode & vbCr & _
"Startdatum : " & stStartdatum & vbCr & _
"Maandbedrag : " & stExpr1 & vbCr &
"Credit Result : " & stCreditC & vbCr & _
"Nassubel Code : " & stNassC & vbCr & _
"Opmerkingen : " & stOpmerk
End With
myItem.Send
Exit_Command33_Click:
Exit Sub
Err_Command33_Click:
MsgBox Err.Description
Resume Exit_Command33_Click
Many thanks !
I have constructed some code that takes data out of a query based on an open form
the data is put into the body of an email and is send
now this is what i wont get to work :
the person who receives the email needs to add or change the
data in the email body so he can send the email back with the
right data
i cant seem to find any solution to make this work, the
data in the email body is read only
this is my code, anyone any ideas on this one :
Private Sub Command33_Click()
On Error GoTo Err_Command33_Click
DoCmd.Echo False 'switch echo off so query is not displayed
DoCmd.OpenQuery "Query : Aanvraag CC", acNormal, acEdit 'open the query to get the email value
DoCmd.Close acQuery, "Query : Aanvraag CC", acSaveNo 'close query
DoCmd.Echo True 'switch echo back on
stKlantId = DLookup("[Klant ID]", "Query : Aanvraag CC")
stNaam = DLookup("[Naam]", "Query : Aanvraag CC")
stAdres = DLookup("[Adres]", "Query : Aanvraag CC")
stWoonplaats = DLookup("[Woonplaats]", "Query : Aanvraag CC")
stPostcode = DLookup("[Postcode]", "Query : Aanvraag CC")
stStartdatum = DLookup("[Startdatum]", "Query : Aanvraag CC")
stExpr1 = DLookup("[Expr1]", "Query : Aanvraag CC")
stCreditC = DLookup("[Credit check]", "Query : Aanvraag CC")
stOpmerk = DLookup("[Opmerkingen]", "Query : Aanvraag CC")
stNassC = DLookup("[Nassubel Code]", "Query : Aanvraag CC")
stBTWnr = DLookup("[BTW nr]", "Query : Aanvraag CC")
Dim myApp As New Outlook.Application
Dim myItem As Outlook.MailItem
Set myItem = myApp.CreateItem(olMailItem)
With myItem.BodyFormat
.Importance = 2
.To = "email address"
.Subject = "Automated Credit Check"
.ReadReceiptRequested = False
.Body = "Credit Check aub :" & vbCr & _
"Klant ID : " & stKlantId & vbCr & _
"Naam : " & stNaam & vbCr & _
"BTW nr : " & stBTWnr & vbCr & _
"Adres : " & stAdres & vbCr & _
"Woonplaats : " & stWoonplaats & vbCr & _
"Postcode : " & stPostcode & vbCr & _
"Startdatum : " & stStartdatum & vbCr & _
"Maandbedrag : " & stExpr1 & vbCr &
"Credit Result : " & stCreditC & vbCr & _
"Nassubel Code : " & stNassC & vbCr & _
"Opmerkingen : " & stOpmerk
End With
myItem.Send
Exit_Command33_Click:
Exit Sub
Err_Command33_Click:
MsgBox Err.Description
Resume Exit_Command33_Click
Many thanks !