error 2282 when using "Access.DoCmd.OutputTo" in the following:

G

Guest

I can do it manually through the menus just fine
but when I tr

string s,s1
s = "c:\\Tr.RTF"
s1 = Access.AcCommand.acCmdOutputToRTF.ToString()
Access.DoCmd.OutputTo(Access.AcOutputObjectType.acOutputTable,"Table2",s1,s,false,false,false)

I get the error

RunTime Error 2282: "The format in which you are attempting to output the current object is not avaible

I hope you help m
Thanks
 
B

Bryan Reich [MSFT]

I believe the format is:

Dim s1 As String
Dim s As String
s = "c:\Tr.RTF"
s1 = "Rich Text Format"
Access.DoCmd.OutputTo Access.acOutputTable, "Table2", s1, s, False

you had a number of syntax mistakes that may have been causing you problems
besides the format string. One example was using semi-colons to terminate
lines. That's C/C++, java and C#, but not VBA. Also, the last 2 arguments
are not booleans and so shouldn't have been "false", but instead, if you
just want to use the defaults, leave the fields empty. Lastly, you were
calling OutputTo as a function (with parenthesis) when I think you wanted a
subroutine (as is shown above, w/o parenthesis).
Hope this helps.
--
Bryan Reich
Microsoft Office
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


Thanh said:
I can do it manually through the menus just fine.
but when I try

string s,s1 ;
s = "c:\\Tr.RTF";
s1 = Access.AcCommand.acCmdOutputToRTF.ToString();
Access.DoCmd.OutputTo(Access.AcOutputObjectType.acOutputTable,"Table2",s1,s,
false,false,false) ;
 

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

Top