Hello,
I have a form that is pulled from a query and shows the results on the form properly. On this form I have a button that sends an email to a recipient with the results from the query/form however the problem is it is only showing one of the records in the email body and not the reminaing records but other than that it sends and all is fine.
Can someone please assist me in making it show all reocrds in a single email?
Here is my code:
I have a form that is pulled from a query and shows the results on the form properly. On this form I have a button that sends an email to a recipient with the results from the query/form however the problem is it is only showing one of the records in the email body and not the reminaing records but other than that it sends and all is fine.
Can someone please assist me in making it show all reocrds in a single email?
Here is my code:
Code:
Option Compare Database
Private Sub cmdReady_For_Pickup_Click()
On Error GoTo Err_cmdReady_For_Pickup_Click
Dim stWhere As String '-- Criteria for DLookup
Dim varFrom As String
Dim varTo As String '-- Address for SendObject
Dim varCC As String
Dim stText As String '-- E-mail text
Dim stSubject As String
Dim ID As String
Dim strSQL As String '-- Create SQL update statement
Dim Label26 As String
Dim lstEmployeePickup As String
Dim errLoop As Error
'-- Email address to
varTo = "Test@test.com"
stSubject = "Ready For Pickup"
stText = "Ready for Pickup" & Chr$(13) & _
Chr$(13) & _
"You are receiving this email because the following Devices are ready for pickup." & Chr$(13) & _
"The technician's name and phone number is listed below." & Chr$(13) & _
Chr$(13) & _
Chr$(13) & _
Chr$(13) & "Tech Name: " & [Tech_First] & " " & [Tech_Last] & _
Chr$(13) & "Tech Number: " & [Tech_Number] & _
Chr$(13) & "Tech's Phone #: " & [Phone_Num] & Chr$(13) & _
Chr$(13) & "Notification Date: " & [Now] & Chr$(13)
DoCmd.SendObject , , acFormatTXT, varTo, varCC, , stSubject, stText, -1
On Error GoTo Err_Execute
On Error GoTo 0
Exit Sub
Err_Execute:
If DBEngine.Errors.Count > 0 Then
For Each errLoop In DBEngine.Errors
MsgBox "Error number: " & errLoop.Number & vbCr & _
errLoop.Description
Next errLoop
End If
Resume Next
Exit_cmdReady_For_Pickup_Click:
Exit Sub
Err_cmdReady_For_Pickup_Click:
MsgBox Err.Description
Resume Exit_cmdReady_For_Pickup_Click
End Sub