Hi,
Im wondering about two things here. I have the following code setup to run. The problem is that when I increase the length of the strmessage variable past a point the send button stops working
---------------------------------------------------------------------------
Dim rsEmail As DAO.Recordset 'the recordset with the email addresses to be used
Dim strEmail As String 'the email address
Dim strMessage As String 'message to be sent
Dim strSubject As String 'subject of message
Dim strOrderNum As String 'the web order number
Dim intEmail_Sent As Boolean
Dim strBillFirstname As String
Dim strBilllastname As String
Dim strShipFirstname As String
Dim strShipLastname As String
Dim strShipCompany As String
Dim strShipAddress As String
Dim strShipAddress2 As String
Dim strShipCity As String
Dim strShipProvince As String
Dim strShipPostalCode As String
Dim strShipCountry As String
Set rsEmail = CurrentDb.OpenRecordset("tmp_email") 'opens table with email addresses
On Error Resume Next 'skips email addresses with errors
Do While Not rsEmail.EOF 'loops through until the end of the table
strEmail = rsEmail.Fields("BillEmail").Value 'sets email address value
strOrderNum = rsEmail.Fields("OrderID").Value 'sets job number value
strBillFirstname = rsEmail.Fields("BillFirstName").Value
strBilllastname = rsEmail.Fields("BilllastName").Value
strShipFirstname = rsEmail.Fields("ShipFirstname").Value
strShipLastname = rsEmail.Fields("ShipLastname").Value
strShipCompany = rsEmail.Fields("ShipCompany").Value
strShipAddress = rsEmail.Fields("ShipAddress").Value
strShipAddress2 = rsEmail.Fields("ShipAddress2").Value
strShipCity = rsEmail.Fields("ShipCity").Value
strShipProvince = rsEmail.Fields("ShipProvince").Value
strShipPostalCode = rsEmail.Fields("ShipPostalCode").Value
strShipCountry = rsEmail.Fields("ShipCountry").Value
strSubject = "Lonley Planet Publications LTD Shipping Notification. Your Refernence: (" & strOrderNum & ")"
strMessage = "Dear " & strBillFirstname & " " & strBilllastname & "," _
& vbCrLf & vbCrLf & "We are please to inform you that your order: (" & strOrderNum & ") has been dispatched to:" _
& vbCrLf & vbCrLf & strShipFirstname & " " & strShipLastname _
& vbCrLf & strShipCompany _
& vbCrLf _
& strShipAddress _
& vbCrLf _
& strShipAddress2 _
& vbCrLf _
& strShipCity _
& vbCrLf _
& strShipProvince _
& vbCrLf _
& strShipPostalCode _
& vbCrLf & strShipCountry & vbCrLf _
DoCmd.SendObject , , , strEmail, , , strSubject, strMessage, False 'sends emails using above parameters
rsEmail.MoveNext 'goes to next record
Loop 'starts whole process over again
Set rsEmail = Nothing 'closes table
'End If
'DoCmd.Close 'closes form when completed
End Sub
*** If I try and add a extra line with just a text comment the code stops working, but if i delete the line the code works again. Its as though there is a max lenth on the message text I can assign. Anyone know how to beat this??
thanks
Im wondering about two things here. I have the following code setup to run. The problem is that when I increase the length of the strmessage variable past a point the send button stops working
---------------------------------------------------------------------------
Dim rsEmail As DAO.Recordset 'the recordset with the email addresses to be used
Dim strEmail As String 'the email address
Dim strMessage As String 'message to be sent
Dim strSubject As String 'subject of message
Dim strOrderNum As String 'the web order number
Dim intEmail_Sent As Boolean
Dim strBillFirstname As String
Dim strBilllastname As String
Dim strShipFirstname As String
Dim strShipLastname As String
Dim strShipCompany As String
Dim strShipAddress As String
Dim strShipAddress2 As String
Dim strShipCity As String
Dim strShipProvince As String
Dim strShipPostalCode As String
Dim strShipCountry As String
Set rsEmail = CurrentDb.OpenRecordset("tmp_email") 'opens table with email addresses
On Error Resume Next 'skips email addresses with errors
Do While Not rsEmail.EOF 'loops through until the end of the table
strEmail = rsEmail.Fields("BillEmail").Value 'sets email address value
strOrderNum = rsEmail.Fields("OrderID").Value 'sets job number value
strBillFirstname = rsEmail.Fields("BillFirstName").Value
strBilllastname = rsEmail.Fields("BilllastName").Value
strShipFirstname = rsEmail.Fields("ShipFirstname").Value
strShipLastname = rsEmail.Fields("ShipLastname").Value
strShipCompany = rsEmail.Fields("ShipCompany").Value
strShipAddress = rsEmail.Fields("ShipAddress").Value
strShipAddress2 = rsEmail.Fields("ShipAddress2").Value
strShipCity = rsEmail.Fields("ShipCity").Value
strShipProvince = rsEmail.Fields("ShipProvince").Value
strShipPostalCode = rsEmail.Fields("ShipPostalCode").Value
strShipCountry = rsEmail.Fields("ShipCountry").Value
strSubject = "Lonley Planet Publications LTD Shipping Notification. Your Refernence: (" & strOrderNum & ")"
strMessage = "Dear " & strBillFirstname & " " & strBilllastname & "," _
& vbCrLf & vbCrLf & "We are please to inform you that your order: (" & strOrderNum & ") has been dispatched to:" _
& vbCrLf & vbCrLf & strShipFirstname & " " & strShipLastname _
& vbCrLf & strShipCompany _
& vbCrLf _
& strShipAddress _
& vbCrLf _
& strShipAddress2 _
& vbCrLf _
& strShipCity _
& vbCrLf _
& strShipProvince _
& vbCrLf _
& strShipPostalCode _
& vbCrLf & strShipCountry & vbCrLf _
DoCmd.SendObject , , , strEmail, , , strSubject, strMessage, False 'sends emails using above parameters
rsEmail.MoveNext 'goes to next record
Loop 'starts whole process over again
Set rsEmail = Nothing 'closes table
'End If
'DoCmd.Close 'closes form when completed
End Sub
*** If I try and add a extra line with just a text comment the code stops working, but if i delete the line the code works again. Its as though there is a max lenth on the message text I can assign. Anyone know how to beat this??
thanks