Hi
I'm trying to base a report on a recordset activated from a form
I'm using the code below, where list18 is a list box on a form. I'm trying to build up the string and then say, send the report target_action_sheet by email based on the recordset. Any ideas much appreciated?
Richey
Dim dbs As Database
Dim str As String
Dim strsql As String
Dim strsql1 As String
Dim rst As Recordset
Set dbs = CurrentDb
str = "SELECT * from target_action_sheet where audit_no=" & Me![List18]
Msgbox (str)
Set rst = dbs.OpenRecordset(str)
strsql = "SELECT responsible from target_action_sheet where recommendation_number =" & rst("recommendation_number"
Msgbox (strsql)
Set rst = dbs.OpenRecordset(strsql)
strsql1 = "SELECT email from tblresponsible where responsible=" & "'" & rst("responsible" & "'"
Set rst = dbs.OpenRecordset(strsql1)
With rst
Msgbox (strsql1)
DoCmd.SendObject acSendReport, "target_action_sheet", acFormatXLS, rst.Fields(0), , , , , False
End With
rst.Close
Set dbs = Nothing
I'm trying to base a report on a recordset activated from a form
I'm using the code below, where list18 is a list box on a form. I'm trying to build up the string and then say, send the report target_action_sheet by email based on the recordset. Any ideas much appreciated?
Richey
Dim dbs As Database
Dim str As String
Dim strsql As String
Dim strsql1 As String
Dim rst As Recordset
Set dbs = CurrentDb
str = "SELECT * from target_action_sheet where audit_no=" & Me![List18]
Msgbox (str)
Set rst = dbs.OpenRecordset(str)
strsql = "SELECT responsible from target_action_sheet where recommendation_number =" & rst("recommendation_number"
Msgbox (strsql)
Set rst = dbs.OpenRecordset(strsql)
strsql1 = "SELECT email from tblresponsible where responsible=" & "'" & rst("responsible" & "'"
Set rst = dbs.OpenRecordset(strsql1)
With rst
Msgbox (strsql1)
DoCmd.SendObject acSendReport, "target_action_sheet", acFormatXLS, rst.Fields(0), , , , , False
End With
rst.Close
Set dbs = Nothing