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

Filling forms with fields from database using Outlook-VBA

Status
Not open for further replies.

FrankTerlien

Technical User
Jan 8, 2003
2
NL
I have build an small company application that uses an Access Database for holiday registration. After the acceptance I would like to fill some details in an outlook form and send that back to either the sender or to his chef.
When I create the message I get the default mail message, bud that should be a form like "Holidayconfirm".
The form is in the " company forms library" and has a ClassId white the name "IPM.Note.Holidayconfirm".
 
Hi,

Do you want to post your code & see if anyone cann spot where it's going wrong?

Sharon
 
Thanks
I found out my way, after posting the question I searched and did try to find some other solutions. To share it...


This is the code that works now.

Sub Confirm()
HolidayConfirm "mymail@home.nl", #3/14/2003#, #3/17/2003#, "Holiday Frank", "this is a message", "Chief", 2, 258
End Sub

'The above values should come from an Access database.
'the application below sends a mail with a lot of userfields.
'if you don't understand some words, it's my mother language dutch.


Sub HolidayConfirm(sUser As String, Begintijd As Date, Eindtijd As Date, _
sBetreft As String, sBericht As String, sChef As String, _
iDagen As Integer, lOrderID As Long)

Dim ol As New Outlook.Application
Dim olns As Outlook.NameSpace
Dim mf As Outlook.MAPIFolder
Dim m As Outlook.MailItem

Set ol = New Outlook.Application
Set olns = ol.GetNamespace("MAPI")
Set mf = olns.GetDefaultFolder(olFolderInbox)
Set m = mf.Items.Add("IPM.Note.Vakantieconfirm")

With m.UserProperties
.Item("Aantal Dagen").Value = iDagen
.Item("Begindatum").Value = Begintijd
.Item("Betreft").Value = sBetreft
.Item("einddatum").Value = Eindtijd
.Item("sBericht").Value = sBericht
.Item("Oke").Value = 0
.Item("Subject").Value = "Vakantieplannen"
.Item("To").Value = sChef
.Item("Usercode").Value = sUser
.Item("Volgnr").Value = lOrderID
End With
m.Send

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top