INTELLIGENT WORK FORUMS FOR COMPUTER PROFESSIONALS
Come Join Us!
Are you a Computer / IT professional? Join Tek-Tips now!
- Talk With Other Members
- Be Notified Of Responses
To Your Posts
- Keyword Search
- One-Click Access To Your
Favorite Forums
- Automated Signatures
On Your Posts
- Best Of All, It's Free!
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.
Partner With Us!
"Best Of Breed" Forums Add Stickiness To Your Site

(Download This Button Today!)
Feedback
"...I just wanted to say that you guys RULE, a million thank you's to whoever created, and/or manages this site. KEEP UP THE GOOD WORK..."
Geography
Where in the world do Tek-Tips members come from?
|
Microsoft: Access Modules (VBA Coding) FAQ
|
Error Resolution
|
DoCmd.OutputTo causes run-time error 2024 or 2302
Posted: 19 May 06
|
After sweating over this problem and not getting anywhere with search, I found the solution is almost as simple as MS describes in their Knowledge Base article.
M$'s example to duplicate the problem
CODESub OutputSnapshot() DoCmd.OutputTo acOutputReport, "Alphabetical List of Products", acFormatSNP, "C:\My Documents\", True End Sub What they don't explain is you need to add the file name to the OutPutFile argument. You can either hard code the name, or you can use a variable if you want to assign different names each time your run the code. In this example, I change the name of the .snp file by assigning the current date to the name.
CODESub OutputSnapshot() Dim myFile as String
myFile = "SomeName" & Format(Date(),"mmddyy") & ".snp" DoCmd.OutputTo acOutputReport, "Alphabetical List of Products", acFormatSNP, "C:\My Documents\" & myFile, True End Sub One hint is to make sure you don't have any invalid characters in the file name which is why my example takes the / out of the date format. HTH
|
Back to Microsoft: Access Modules (VBA Coding) FAQ Index
Back to Microsoft: Access Modules (VBA Coding) Forum |
|
 |
|
Join Tek-Tips® Today!
Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.
Here's Why Members Love Tek-Tips Forums:
Talk To Other Members
- Notification Of Responses To Questions
- Favorite Forums One Click Access
- Keyword Search Of All Posts, And More...
Register now while it's still free!
Already a member? Close this window and log in.
Join Us Close