R
Rachel
I have tried every code I can find on the internet to no avail. I have one
giant report grouped by customer_code that I want to automate to break up
into individual reports based on customer_code, export to .snp files using
their individual customer_code as the file name. I'm using Access 2003. My
report is based off of a table and has several subreports in it.
Here's the last code I've tried:
Dim rs As New ADODB.Recordset
Dim cnn As ADODB.Connection
Dim strSQL As String
Dim strEmp As String
Set cnn = CurrentProject.Connection
strSQL = "SELECT * From Tbl_Dealers_for_Scorecard"
rs.Open strSQL, cnn, adOpenKeyset, adLockOptimistic, adCmdText
If rs.RecordCount > 0 Then
rs.MoveFirst
Do While Not rs.EOF
strEmp = rs.Fields("CUSTOMER_CODE").Value
DoCmd.OutputTo acReport, "Rpt_Dealer_Scorecards",
"SnapshotFormat(*.snp)", "D:\Documents and Settings\fm038\My
Documents\PROJECTS - DEPT\Sales - Freight\Dealer Sales
Comparison\Rpt_Dealer_Scorecards.snp", True
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
It gives me a compile error on "Set cnn = CurrentProject.Connection" as an
invalid outiside procedure. Then, if I just close the module and open up my
report - it gives me compile errors in my iif statements on the queries used
for the subreports! ALSO - I know this won't name the files like I want -
was just trying to start somewhere!
I'm not totally Access retarded...but this code is sure making me feel that
way!
Thank you in advance for any help!
-Rachel
giant report grouped by customer_code that I want to automate to break up
into individual reports based on customer_code, export to .snp files using
their individual customer_code as the file name. I'm using Access 2003. My
report is based off of a table and has several subreports in it.
Here's the last code I've tried:
Dim rs As New ADODB.Recordset
Dim cnn As ADODB.Connection
Dim strSQL As String
Dim strEmp As String
Set cnn = CurrentProject.Connection
strSQL = "SELECT * From Tbl_Dealers_for_Scorecard"
rs.Open strSQL, cnn, adOpenKeyset, adLockOptimistic, adCmdText
If rs.RecordCount > 0 Then
rs.MoveFirst
Do While Not rs.EOF
strEmp = rs.Fields("CUSTOMER_CODE").Value
DoCmd.OutputTo acReport, "Rpt_Dealer_Scorecards",
"SnapshotFormat(*.snp)", "D:\Documents and Settings\fm038\My
Documents\PROJECTS - DEPT\Sales - Freight\Dealer Sales
Comparison\Rpt_Dealer_Scorecards.snp", True
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
It gives me a compile error on "Set cnn = CurrentProject.Connection" as an
invalid outiside procedure. Then, if I just close the module and open up my
report - it gives me compile errors in my iif statements on the queries used
for the subreports! ALSO - I know this won't name the files like I want -
was just trying to start somewhere!
I'm not totally Access retarded...but this code is sure making me feel that
way!
Thank you in advance for any help!
-Rachel