Hey guys. i am really stuck here and am ready to give up... i really hope someone can help. I am kind of new so bear with with me. I have a database that basically emails information off to those who need to fix whatever is being sent. It works ok as long as there is not more that one record for the item and qty. I am assuming it is because i am using a Dlookup and from what i understand it will only show one record. How can i make this code work to show everything that is in the table "test"? From research maybe a openrecordset but unfortunately i have no idea how to do this. I will be so thankful for any help you can give!
Code:
Private Sub Command4_Click()
On Error GoTo Err_SendInfo_Click
Dim varTo As Variant
Dim varCC As Variant
Dim stSubject As String
Dim stItem As String
Dim stQty As String
Dim stPO As String
Dim stFirstName As String
Dim stLastName As String
Dim stAddress1 As String
Dim stAddress2 As String
Dim stCity As String
Dim stState As String
Dim stZip As String
Dim stPhoneInfo As String
Dim stPhone As String
varTo = DLookup("[Email]", "tblEmail")
varCC = DLookup("[CC]", "tblEmail")
stSubject = "RDC DTC Order Shipping Change"
stItem = DLookup("Item", "Test")
stQty = DLookup("Qty", "Test")
stPO = Me.PO
stFirstName = Me.Firstname
stLastName = Me.lastname
stAddress1 = Me.address1
stAddress2 = Me.address2
stCity = Me.City
stState = Me.State
stZip = Me.zip
stPhoneInfo = Me.phoneinfo
stPhone = Me.phone
stText = Chr$(13) & Chr$(13) & _
"PO: " & stPO & Chr$(13) & _
"First Name: " & stFirstName & Chr$(13) & _
"Last Name: " & stLastName & Chr$(13) & _
"Address #1: " & stAddress1 & Chr$(13) & _
"Address #2: " & stAddress2 & Chr$(13) & _
"City: " & stCity & Chr$(13) & _
"State: " & stState & Chr$(13) & _
"Zip Code: " & stZip & Chr$(13) & _
"Phone Info: " & stPhoneInfo & Chr$(13) & _
"Phone #: " & stPhone & Chr$(13) & _
"Item #: " & stItem & Chr$(13) & _
"Item #: " & stQty
DoCmd.SendObject , , acFormatTXT, varTo, varCC, , stSubject, stText, -1
On Error GoTo Err_Execute
CurrentDb.Execute strSQL, dbFailOnError
On Error GoTo 0
Exit Sub
Err_Execute:
Resume Next
Exit_SendInfo_Click:
Exit Sub
Err_SendInfo_Click:
MsgBox Err.Description
Resume Exit_SendInfo_Click
End Sub