Export Repost Help

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top