D
D
Hi:
This code is soppoed to export every page/store to a separate file, but
exports to a 21 files/stores and every file contains all 21 stores; should be
one file=on store..
Any help is greatly appreciated!
Thanks,
Dan
******************
Private Sub Command26_Click()
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim BaseSQL As String
Dim strSQL As String
Set rst = CurrentDb.OpenRecordset("SELECT DISTINCT natl_str_nbr FROM
[mcdeal pilot all days]", dbOpenDynaset, dbReadOnly)
Set qdf = CurrentDb.QueryDefs("[mcdeal all]")
BaseSQL = Left(qdf.SQL, Len(qdf.SQL) - 3)
With rst
Do Until .EOF
strSQL = BaseSQL & " WHERE natl_str_nbr=" & ![natl_str_nbr]
qdf.SQL = strSQL
DoCmd.OutputTo acOutputReport, "mcdeal all stores all days",
"richtextFormat", "C:\Documents and Settings\dpopescu\Desktop\mcdeal\" &
![natl_str_nbr] & ".rtf"
.MoveNext
Loop
.Close
End With
qdf.SQL = BaseSQL
Set qdf = Nothing
Set rst = Nothing
End Sub
This code is soppoed to export every page/store to a separate file, but
exports to a 21 files/stores and every file contains all 21 stores; should be
one file=on store..
Any help is greatly appreciated!
Thanks,
Dan
******************
Private Sub Command26_Click()
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim BaseSQL As String
Dim strSQL As String
Set rst = CurrentDb.OpenRecordset("SELECT DISTINCT natl_str_nbr FROM
[mcdeal pilot all days]", dbOpenDynaset, dbReadOnly)
Set qdf = CurrentDb.QueryDefs("[mcdeal all]")
BaseSQL = Left(qdf.SQL, Len(qdf.SQL) - 3)
With rst
Do Until .EOF
strSQL = BaseSQL & " WHERE natl_str_nbr=" & ![natl_str_nbr]
qdf.SQL = strSQL
DoCmd.OutputTo acOutputReport, "mcdeal all stores all days",
"richtextFormat", "C:\Documents and Settings\dpopescu\Desktop\mcdeal\" &
![natl_str_nbr] & ".rtf"
.MoveNext
Loop
.Close
End With
qdf.SQL = BaseSQL
Set qdf = Nothing
Set rst = Nothing
End Sub