Rainbowhawk
Registered User.
- Local time
- Today, 14:09
- Joined
- Oct 8, 2007
- Messages
- 54
Hi All
I am currently building an email using the code below, ugly but it seems to work in general.
the problem i am trying to overcome is the fields
[DailyExceptionReportV3]![Items subform5].[Form]![Item]
and
[DailyExceptionReportV3]![Items subform5].[Form]![Products]
only give the first item, I can not seem to work out how to replace this with a loop that scrolls through all items related to the Order Number.
Any help appreciated.
I am currently building an email using the code below, ugly but it seems to work in general.
Private Sub Command3_Click()
Dim Info As String
Dim olkapp As Outlook.Application
Dim olknamespace As Outlook.NameSpace
Dim objmailitem As Outlook.MailItem
Info = "Order Number: " & [Forms]![exceptionsinput]![Order Number] & Chr(13) & Chr(10) & "Customer Name: " & [Forms]![exceptionsinput]![exceptioninput_detail].[Form]![Customer Name] & Chr(13) & Chr(10) & "Outbase: " & [Forms]![exceptionsinput]![exceptioninput_detail].[Form]![Depot ID] & Chr(13) & Chr(10) & "Time Reported: " & [Forms]![DailyExceptionReportV3]![Exception Report time] & Chr(13) & Chr(10) & "Driver Details: " & [Forms]![DailyExceptionReportV3]![Items subform5].[Form]![Driver] & Chr(13) & Chr(10) & "Driver Number: " & [Forms]![exceptionsinput]![TelephoneNumber] & Chr(13) & Chr(10) & "Route: " & [Forms]![exceptionsinput]![exceptioninput_detail].[Form]![B&Q Route Number] & " Drop: " & [Forms]![exceptionsinput]![exceptioninput_detail].[Form]![Call No] & Chr(13) & Chr(10) & "Items " & [Forms]![DailyExceptionReportV3]![Items subform5].[Form]![Item] & " " & [Forms]![DailyExceptionReportV3]![Items subform5].[Form]![Product] & Chr(13) & Chr(10) & [Forms]![DailyExceptionReportV3]![Notes]
Set olkapp = New Outlook.Application
Set olknamespace = GetNamespace("MAPI")
Set objmailitem = olkapp.CreateItem(olMailItem)
With objmailitem
.To = "a@b.com"
.Recipients.ResolveAll
.Subject = "Delivery Exception"
.Body = Info
.Send
End With
Set objmailitem = Nothing
Set olknamespace = Nothing
Set olkapp = Nothing
End Sub
the problem i am trying to overcome is the fields
[DailyExceptionReportV3]![Items subform5].[Form]![Item]
and
[DailyExceptionReportV3]![Items subform5].[Form]![Products]
only give the first item, I can not seem to work out how to replace this with a loop that scrolls through all items related to the Order Number.
Any help appreciated.