roxannep
Technical User
- Jun 20, 2000
- 69
I have a Make Table Query that sets up a table wherein one field may have one of three options. Depending on the option, a particular email message needs to go out to them.
Below is the code (and I am new to this, so please bear with all the obvious errors), and I get a message back telling me it cannot find my field "|" and highlights the Select Case [AuctionCode] line.
Public Sub Shipping_Email_Confirmation_Click()
Dim db As Database, rst As Recordset
Dim a As Integer, EmailInfo As String
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblEmailShipConfirmBP"
rst.MoveLast
rst.MoveFirst
For a = 1 To rst.RecordCount
' Infomation could also change here
Select Case [AuctionCode]
'emails for customers purchasing from Ebay
Case "E"
EmailInfo = "Shipping Confirmation for "
EmailInfo = EmailInfo & rst![Title] & ", "
EmailInfo = EmailInfo & "Ebay Confirmation No. " & rst![Item]
EmailInfo = EmailInfo & ". The product you purchased through E-Bay was shipped on " & rst![ShipDate]
EmailInfo = EmailInfo & " to "
EmailInfo = EmailInfo & rst![Name] & " at "
EmailInfo = EmailInfo & rst![Address] & ", "
EmailInfo = EmailInfo & rst![City] & ", " & rst![StateorProvince] & " " & rst![PostalCode] & "." & Chr$(10) & Chr$(13)
EmailInfo = EmailInfo & "" & Chr$(10) & Chr$(13)
EmailInfo = EmailInfo & "If any of this information is incorrect, please contact us at 360-699-1795. And thank you for your order!"
'emails for customers purchasing from Yahoo
Case "Y"
EmailInfo = "Shipping Confirmation for "
EmailInfo = EmailInfo & rst![Title] & ", "
EmailInfo = EmailInfo & "Yahoo Confirmation No. " & rst![Item]
EmailInfo = EmailInfo & ". The product you purchased through Yahoo was shipped on " & rst![ShipDate]
EmailInfo = EmailInfo & " to "
EmailInfo = EmailInfo & rst![Name] & " at "
EmailInfo = EmailInfo & rst![Address] & ", "
EmailInfo = EmailInfo & rst![City] & ", " & rst![StateorProvince] & " " & rst![PostalCode] & "." & Chr$(10) & Chr$(13)
EmailInfo = EmailInfo & "" & Chr$(10) & Chr$(13)
EmailInfo = EmailInfo & "If any of this information is incorrect, please contact us at 360-699-1795. And thank you for your order!"
'emails for customers purchasing from Amazon
Case "A"
EmailInfo = "Shipping Confirmation for "
EmailInfo = EmailInfo & rst![Title] & ", "
EmailInfo = EmailInfo & "Amazon Confirmation No. " & rst![Item]
EmailInfo = EmailInfo & ". The product you purchased through Amazon was shipped on " & rst![ShipDate]
EmailInfo = EmailInfo & " to "
EmailInfo = EmailInfo & rst![Name] & " at "
EmailInfo = EmailInfo & rst![Address] & ", "
EmailInfo = EmailInfo & rst![City] & ", " & rst![StateorProvince] & " " & rst![PostalCode] & "." & Chr$(10) & Chr$(13)
EmailInfo = EmailInfo & "" & Chr$(10) & Chr$(13)
EmailInfo = EmailInfo & "If any of this information is incorrect, please contact us at 360-699-1795. And thank you for your order!"
End Select
DoCmd.SendObject acSendNoObject, " ", acFormatTXT, rst!EmailName, , , "Shipping Confirmation", EmailInfo, False, " "
rst.MoveNext
Next
DoCmd.Close
End Sub
Below is the code (and I am new to this, so please bear with all the obvious errors), and I get a message back telling me it cannot find my field "|" and highlights the Select Case [AuctionCode] line.
Public Sub Shipping_Email_Confirmation_Click()
Dim db As Database, rst As Recordset
Dim a As Integer, EmailInfo As String
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblEmailShipConfirmBP"
rst.MoveLast
rst.MoveFirst
For a = 1 To rst.RecordCount
' Infomation could also change here
Select Case [AuctionCode]
'emails for customers purchasing from Ebay
Case "E"
EmailInfo = "Shipping Confirmation for "
EmailInfo = EmailInfo & rst![Title] & ", "
EmailInfo = EmailInfo & "Ebay Confirmation No. " & rst![Item]
EmailInfo = EmailInfo & ". The product you purchased through E-Bay was shipped on " & rst![ShipDate]
EmailInfo = EmailInfo & " to "
EmailInfo = EmailInfo & rst![Name] & " at "
EmailInfo = EmailInfo & rst![Address] & ", "
EmailInfo = EmailInfo & rst![City] & ", " & rst![StateorProvince] & " " & rst![PostalCode] & "." & Chr$(10) & Chr$(13)
EmailInfo = EmailInfo & "" & Chr$(10) & Chr$(13)
EmailInfo = EmailInfo & "If any of this information is incorrect, please contact us at 360-699-1795. And thank you for your order!"
'emails for customers purchasing from Yahoo
Case "Y"
EmailInfo = "Shipping Confirmation for "
EmailInfo = EmailInfo & rst![Title] & ", "
EmailInfo = EmailInfo & "Yahoo Confirmation No. " & rst![Item]
EmailInfo = EmailInfo & ". The product you purchased through Yahoo was shipped on " & rst![ShipDate]
EmailInfo = EmailInfo & " to "
EmailInfo = EmailInfo & rst![Name] & " at "
EmailInfo = EmailInfo & rst![Address] & ", "
EmailInfo = EmailInfo & rst![City] & ", " & rst![StateorProvince] & " " & rst![PostalCode] & "." & Chr$(10) & Chr$(13)
EmailInfo = EmailInfo & "" & Chr$(10) & Chr$(13)
EmailInfo = EmailInfo & "If any of this information is incorrect, please contact us at 360-699-1795. And thank you for your order!"
'emails for customers purchasing from Amazon
Case "A"
EmailInfo = "Shipping Confirmation for "
EmailInfo = EmailInfo & rst![Title] & ", "
EmailInfo = EmailInfo & "Amazon Confirmation No. " & rst![Item]
EmailInfo = EmailInfo & ". The product you purchased through Amazon was shipped on " & rst![ShipDate]
EmailInfo = EmailInfo & " to "
EmailInfo = EmailInfo & rst![Name] & " at "
EmailInfo = EmailInfo & rst![Address] & ", "
EmailInfo = EmailInfo & rst![City] & ", " & rst![StateorProvince] & " " & rst![PostalCode] & "." & Chr$(10) & Chr$(13)
EmailInfo = EmailInfo & "" & Chr$(10) & Chr$(13)
EmailInfo = EmailInfo & "If any of this information is incorrect, please contact us at 360-699-1795. And thank you for your order!"
End Select
DoCmd.SendObject acSendNoObject, " ", acFormatTXT, rst!EmailName, , , "Shipping Confirmation", EmailInfo, False, " "
rst.MoveNext
Next
DoCmd.Close
End Sub