Mitch Swetsky
asked on
Access VBA to Output table to Excel Workbook
I am getting a message that the format which I am attempting to output the object is not available
I don't understand why.
Can someone help?
I don't understand why.
Can someone help?
DoCmd.OutputTo acTable, FinalTb, "Excel97-Excel2003Workbook(*.xls)", "Q:\MIS\FASM\Wl2011\Reports\" & FinalTb & ".xls", False, "", 0
ASKER
The message is
Run-time error '2282': The format in which you are attempting to output the current object is not available.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Swap the "Excel97-Excel2003Workbook (*.xls)"
for
acFormatXLS
The explicit versioning may be giving you the problem.
-Rachel
for
acFormatXLS
The explicit versioning may be giving you the problem.
-Rachel
A little too slow on my part.
The error is because of the quotes -- RemRemRem caught that in the first comment
The error is because of the quotes -- RemRemRem caught that in the first comment
ASKER
I get a compile error
Syntax error.
There is a microsoft article referencing the above 2282 error but I don't understand the workaround
http://support.microsoft.com/kb/934833
Syntax error.
There is a microsoft article referencing the above 2282 error but I don't understand the workaround
http://support.microsoft.com/kb/934833
ASKER
DoCmd.OutputTo acTable, FinalTb, "acFormatXLS", "Q:\MIS\FASM\Wlea2011\Repo rts\" & FinalTb & ".xls", False, , 0
is still giving the 2282
is still giving the 2282
ASKER
I dont know if it matters but the table name is a variable
Ok, next mod - try having the following string (inclusive of all the double-single-double quotes) instead of your FinalTB:
"'" & FinalTB & "'"
-Rachel
"'" & FinalTB & "'"
-Rachel
ASKER
I am sorry. I don't understand your suggestion
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am running 2003 SP3 on our server.
I did some development on my local 2007 SP2 but it needs to run on 2003
I did some development on my local 2007 SP2 but it needs to run on 2003
ASKER
OK It looks like the below works in Access 2003.
Thank you both so much for your patience and assistance.
DoCmd.OutputTo acTable, FinalTb, acFormatXLS, "Q:\MIS\FASM\Wlea2011\Repo rts\" & FinalTb & ".xls", False, , 0
Thank you both so much for your patience and assistance.
DoCmd.OutputTo acTable, FinalTb, acFormatXLS, "Q:\MIS\FASM\Wlea2011\Repo
Open in new window
Don't use "" in your TemplateFile value, and wrap parens around the attributes list. Also, if "FinalTB" isn't a variable you're sending in, it needs to be in quotes in both uses. I'm assuming it is, even though you haven't given us the precedent code.
Hope that helps.
-Rachel Morris