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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controling where a message is placed

Status
Not open for further replies.

neeko1226

MIS
Jul 24, 2003
82
0
0
US
I am using the Docmd.sendobject to send an email from an access database. Currently, the email message is populating at the end of my signature. My email program is Lotus Notes, and in my signature I have two blank lines before it begins. Here's the code I have:
DoCmd.SendObject , , , Me.EmpEmail, , , Me.TxtSubject.Value, Me.TxtMessage.Value
 
Hallo,

In Lotus Notes, can you specify where the insertion point is for a message, before or after signature. I think you can is MS Outlook.

Dunno if that helps. Another option would be to not include a signature in Lotus, but append the text of it after Me.TxtMessage.Value in your SendObject statement.

- Frink

PS. Generally you use ! when referring to fields on a form, not .
ie. Me.TxtMessage.Value becomes Me!TxtMessage
 
When i send mail through Lotus notes the signature doesn't get attached at all. Could you tel me what version of notes are you using? & How do you get the signature to appear (even if it's in the wrong place)? I would be grateful for any input.

Dim notes_session As Object ' Notes session
Dim notesdb As Object ' Notes database
Dim notes_doc As Object ' Notes document (memo)
Dim overdue_rst As Recordset
Dim db As Database
Dim sql_string As String

Set db = CurrentDb

sql_string = "SELECT DISTINCTROW tblbookings.ResID, tblbookings.StartDate, tblbookings.EndDate, tblUsers.Firstname, tblUsers.Surname, tblUsers.TelExt, tblUsers.Dept, tblbookings.ID FROM tblUsers LEFT JOIN tblbookings ON tblUsers.UserID = tblbookings.UserID WHERE (((tblbookings.EndDate)<Date()) AND ((tblbookings.Status)<>'Returned'));"

Set overdue_rst = db.OpenRecordset(sql_string)

If overdue_rst.RecordCount > 0 Then

overdue_rst.MoveLast
overdue_rst.MoveFirst

While Not overdue_rst.EOF

Set notes_session = CreateObject("Notes.Notessession") ' create Notes session
Set notesdb = notes_session.GETDATABASE("", "") ' set notes_db to database not yet named
Call notesdb.OPENMAIL ' assigns notes_db to current user's mail

Set notes_doc = notesdb.CreateDocument ' create new email
notes_doc.Form = "Memo"
notes_doc.SendTo = overdue_rst!Firstname & "." & overdue_rst!Surname & "@amra.co.uk" ' fills the who field in notes
notes_doc.subject = "Resource return request"
notes_doc.body = "This is an IT department automated message to imform you that the resource you have borrowed is overdue for return. Please return the item to the IT department immediately. Thankyou for your cooperation. "
notes_doc.SaveMessageOnSend = True ' save in sent box if true
'Send the document
notes_doc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
notes_doc.SEND 0, ""
overdue_rst.MoveNext

Wend

End If

overdue_rst.Close
Set notesdb = Nothing
Set notes_doc = Nothing
Set notes_session = Nothing

Only dead fish (and shit) go with the flow!
 
jaydeebe - We are using version 5.0.9 Released Nov, 2001. To add a signature, start from your inbox. Click Tools, then Preferences. There should be a signature tab.

I have also used something very simalar to the code above and it works great. Another developer in my group showed me the Docmd.SendObject and I thought if I can get the same result with one line of code I would do it. I will stick with what works, as I have also found that the Docmd.SendObject does not actually send the email.

Thank you both for your input.

Neeko
 
I'm on version 5.0.8. I already have set up the signature in notes and it works fine when i go into notes and send an email. It is only when sending from Access that the signature doesn't appear.

Does this sendobject work for access 97? At the moment i have this code for sending via outlook and it's just as long as my notes code.

Private Sub Command70_Click()

'Create Instance of Outlook
Dim strSubject As String
Dim overdue_rst As Recordset
Dim db As Database
Dim sql_string As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set db = CurrentDb

sql_string = "SELECT DISTINCTROW tblbookings.ResID,
tblbookings.StartDate, tblbookings.EndDate, tblUsers.Firstname,
tblUsers.Surname, tblUsers.TelExt, tblUsers.Dept, tblbookings.ID FROM
tblUsers LEFT JOIN tblbookings ON tblUsers.UserID = tblbookings.UserID
WHERE (((tblbookings.EndDate)<Date()) AND
((tblbookings.Status)<>'Returned'));"

Set overdue_rst = db.OpenRecordset(sql_string)

If overdue_rst.RecordCount > 0 Then

overdue_rst.MoveLast
overdue_rst.MoveFirst

While Not overdue_rst.EOF

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)


'Create and Send Email
With objEmail

.To = overdue_rst!Firstname & "." & overdue_rst!Surname & "@amra.co.uk"
.Subject = strSubject
.Body = "This is an IT department automated message to inform you
that the resource you have borrowed is overdue for return. Please
return the item to the IT department immediately. Thank you for your
cooperation. "
'Send 'Sends message immediately
.display 'lets user edit message before sending

End With

'objOutlook.Quit
Exit Sub
'End Code
overdue_rst.MoveNext

Wend

End If

'Close Outlook
Set objEmail = Nothing
overdue_rst.Close

End Sub

Only dead fish (and shit) go with the flow!
 
recipient = overdue_rst!Firstname & "." & overdue_rst!Surname & "@amra.co.uk"
DoCmd.SendObject acSendNoObject, , , recipient, , , "test message", "blahblahblah", False, False
overdue_rst.MoveNext

Ok sendobject works for both notes and outlook which is helpful with respect to having generic code, but i also experience the problem of the signature appearing before the body. Also, can i get the message to send immediately. I tried setting editmessage to false but this didn't work.

Only dead fish (and shit) go with the flow!
 
This database is in Access 97. SendObject will populate the address line, the subject line, and the message(at the end of the signature if there is one), but will not actually send the message. You have to actually go to Notes and click send.

-Neeko
 
Ok cheers for the info. I will stick with what i have as i have no wish to edit the message before i send it. My Access app tells me emails have been sent by way of a pop up form when the emailing code is triggered.

Only dead fish (and shit) go with the flow!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top