Q
quixote
I have the following code that works great with the help of this forum. When
I do the debug.print, the data shows up in the debug window as it should. I
am trying to use the Sendobject method so I can dump info for each Job number
on a seperate email. For example, here is a sample of the data that is
produced from below:
-------------------------------------------------------------
2095
14
5
15
3035
28
3043
6
------------------------------------------------------------------
This means for Job 2095 the order numbers with a status of quoted are 14,5,15
For Job 3035 the order number(s) with a status of quoted is 28
etc.
So, for email 1 I would need this info on it
2095
14
5
15
For email 2 I would need
3035
28
For email 3 I would need
3043
6
I can't figure out how to do this. I can get it to send a seperate email for
each order, ie Job Num 2095 produces 3 emails. Any ideas how I can accomplish
this?
Thanks,
--------------------------------------------------------------------------------------------------------------------------------------------
Dim db As Database
Dim rst As Recordset
Dim strSQL As String
Dim str2SQL As String
Dim rst2 As Recordset
Set db = CurrentDb
strSQL = "Select JobNum from qryForEmail"
Set rst = db.OpenRecordset(strSQL)
Do While Not rst.EOF
Debug.Print rst.Fields("JobNum")
str2SQL = "SELECT * FROM tblOrder WHERE JobNum = " & rst!JobNum & "" &
" AND Status = 'Quoted'"
Set rst2 = db.OpenRecordset(str2SQL)
Do While Not rst2.EOF
Debug.Print rst2.Fields("OrderNum")
rst2.MoveNext
Loop
rst.MoveNext
I do the debug.print, the data shows up in the debug window as it should. I
am trying to use the Sendobject method so I can dump info for each Job number
on a seperate email. For example, here is a sample of the data that is
produced from below:
-------------------------------------------------------------
2095
14
5
15
3035
28
3043
6
------------------------------------------------------------------
This means for Job 2095 the order numbers with a status of quoted are 14,5,15
For Job 3035 the order number(s) with a status of quoted is 28
etc.
So, for email 1 I would need this info on it
2095
14
5
15
For email 2 I would need
3035
28
For email 3 I would need
3043
6
I can't figure out how to do this. I can get it to send a seperate email for
each order, ie Job Num 2095 produces 3 emails. Any ideas how I can accomplish
this?
Thanks,
--------------------------------------------------------------------------------------------------------------------------------------------
Dim db As Database
Dim rst As Recordset
Dim strSQL As String
Dim str2SQL As String
Dim rst2 As Recordset
Set db = CurrentDb
strSQL = "Select JobNum from qryForEmail"
Set rst = db.OpenRecordset(strSQL)
Do While Not rst.EOF
Debug.Print rst.Fields("JobNum")
str2SQL = "SELECT * FROM tblOrder WHERE JobNum = " & rst!JobNum & "" &
" AND Status = 'Quoted'"
Set rst2 = db.OpenRecordset(str2SQL)
Do While Not rst2.EOF
Debug.Print rst2.Fields("OrderNum")
rst2.MoveNext
Loop
rst.MoveNext