I have a database we use for order tracking. I collect information such as the vendor we purchased from as well as tracking information from each vendor for each order. Sometime the orders require multiple vendors and multiple tracking numbers. What I would like is a button to send all the tracking numbers for an order to the customers email.
this is what I have so far:
I just need to know how to run the following sql statement
the PO_NUM will come from the form
Any help would be tremendous!
this is what I have so far:
Code:
Private Sub Command9_Click()
'Send the E-Mail
Dim oApp As Outlook.Application
Dim oMail As MailItem
Dim Subjectline As String
Dim emailaddr As String
Dim SC As String
Dim PO As String
Dim SalesC As String
PO = Forms![Orders].[PO_NUM]
SC = DLookup("SalesChannel", "orders", "PO_NUM ='" & PO & "'")
emailaddr = DLookup("Cust_EMAIL", "orders", "PO_NUM ='" & PO & "'")
If SC = "1" Then
SalesC = "DoD EMALL"
Else
If SC = "2" Then
SalesC = "GSA Advantage"
Else
SalesC = ""
End If
End If
Subjectline = "Tracking Inforamtion for your " & SalesC & " Order " & PO
Set oApp = CreateObject("Outlook.application")
Dim MyBodyText As String
MyBodyText = "QUERY RESULTS SOMEHOW"
Set oMail = oApp.CreateItem(olMailItem)
oMail.Body = MyBodyText
oMail.Subject = Subjectline
oMail.To = emailaddr
'oMail.Send
oMail.Display
Set oMail = Nothing
Set oApp = Nothing
End Sub
Code:
SELECT ShippingAndDelivery.TrackingReceived, ShippingAndDelivery.TrackingNumber, ShippingAndDelivery.ShipMethod FROM Orders INNER JOIN ShippingAndDelivery ON Orders.PO_NUM = ShippingAndDelivery.PONbr WHERE (((Orders.PO_NUM)="MOMS00006806531"));
Any help would be tremendous!
Comment