robinski
asked on
Naming an output file
I am attempting to output club records from an Access database to an XLS format on a 'per club' basis using a command button and a parameter query.
I can output the single club file with this line:
DoCmd.OutputTo acQuery, "qryRollCall2XLS",
"MicrosoftExcelBiff8*.xls) ", "E:\###\Database.xls", True, "", 0
using the parameter query.
I then attempted to make separate XLS files per club with this which is based on code I use to make RTF output from a report.
DoCmd.OutputTo acQuery, "qryRollCall2XLS",
"MicrosoftExcelBiff8 *.xls)", "E:\###\" "Database_ID" & Me![Club
Ident] & ".xls", True, "", 0
I have not adapted it correctly because the error message reports that it can't find the field [Club Ident].
The next task will be to learn about making the separate XLS files without the need to use the command button 60 times.
Robin Chapple
I can output the single club file with this line:
DoCmd.OutputTo acQuery, "qryRollCall2XLS",
"MicrosoftExcelBiff8*.xls)
using the parameter query.
I then attempted to make separate XLS files per club with this which is based on code I use to make RTF output from a report.
DoCmd.OutputTo acQuery, "qryRollCall2XLS",
"MicrosoftExcelBiff8 *.xls)", "E:\###\" "Database_ID" & Me![Club
Ident] & ".xls", True, "", 0
I have not adapted it correctly because the error message reports that it can't find the field [Club Ident].
The next task will be to learn about making the separate XLS files without the need to use the command button 60 times.
Robin Chapple
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
..oh you need to create another query......qryRollCall3XLS
If MyRec.eof and Myrec.bof then
I = Msgbox("NoRecords in tblClubs",vbokonly, "Error")
Else
MyRec.MoveFirst
For I = 0 to MyRec.recordcount -1
MyDb.QueryDefs("qryRollCal l3XLS").SQ L = "SELECT * FROM qryRollCall2XLS WHERE ClubID ='" & MyRec!ClubID & "'"
DoCmd.OutputTo acQuery, "qryRollCall3XLS","Microso ftExcelBif f8 *.xls)", "E:\###\" & MyRec!DatabaseID & MyRec!ClubId & ".xls", True, "", 0
MyRec.movenext
Loop
End If
hehe...having a blonde day
I = Msgbox("NoRecords in tblClubs",vbokonly, "Error")
Else
MyRec.MoveFirst
For I = 0 to MyRec.recordcount -1
MyDb.QueryDefs("qryRollCal
DoCmd.OutputTo acQuery, "qryRollCall3XLS","Microso
MyRec.movenext
Loop
End If
hehe...having a blonde day
ASKER
Zenmasterrr
Thanks for your help.
I am testing Item One first;
I notice a closing ) without an opening (
and in all the other pieces of code.
Is that confirmed?
Please also confirm that subsequent code is designed to produce the 60 files, in which case the points will be revised to 500 because I intended a separate question for that.
Robin
Thanks for your help.
I am testing Item One first;
I notice a closing ) without an opening (
and in all the other pieces of code.
Is that confirmed?
Please also confirm that subsequent code is designed to produce the 60 files, in which case the points will be revised to 500 because I intended a separate question for that.
Robin
DoCmd.OutputTo acQuery, "qryRollCall2XLS",
"MicrosoftExcelBiff8 *.xls)", "E:\###\" & "Database_ID" & Me![Club
Ident] & ".xls", True, "", 0