473,322 Members | 1,307 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

output file error

ddtpmyra
333 100+
Here's my code
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command2_Click()
  2. On Error GoTo Err_Command1_Click
  3.  
  4.     Dim stDocName As String
  5.  
  6.     stDocName = "Report"
  7.  
  8.     DoCmd.OutputTo acOutputQuery, stQueryName, acFormatXLS, "C:\data reports\" & CStr(stDocName) & ".xls"
  9.  
  10. Exit_Command1_Click:
  11.     Exit Sub
  12.  
  13. Err_Command1_Click:
  14.     MsgBox Err.Description
  15.     Resume Exit_Command1_Click
  16.  
  17. End Sub
  18.  
and here's the error...
"An expression you entered is the wrong data type for one of the arguments"

What did i missed?
Jun 9 '11 #1
2 1208
ddtpmyra
333 100+
To make it simplier I hardcoded the filename and it works...
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OutputTo acOutputQuery, stDocName, acSpreadsheetTypeExcel9, "c:\data reports\test.xls"
Jun 9 '11 #2
NeoPa
32,556 Expert Mod 16PB
Please see What to Include in a Thread Asking for Help.

Your OutputFile parameter actually appears to be fine. The difference I notice in your two versions is that in the first you use a different value for OutputFormat, but more significantly, a different reference for ObjectName. I say reference as you don't seem to have supplied any value in your first example, but just an empty variable (It's certainly not defined or set in any of the code you posted) stQueryName. See Require Variable Declaration for ensuring you avoid such easily avoidable errors in future.
Jun 10 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: tram | last post by:
How do we pass on the step1 output file to step2 of the same job? I would like to know the current job's output file programmetically, instead of hard coding it. Any idaes would be appreciated. ...
0
by: Ben | last post by:
All of sudden, compiling my c# program fails with the following error: error CS0016: Could not write to output file '...\myapp.exe' -- 'The process cannot access the file because it is being...
4
by: Mountain Bikn' Guy | last post by:
I am having serious problems with the following IDE bug: Could not write to output file 'x.dll' -- 'The process cannot access the file because it is being used by another process. ' and BUG:...
3
by: Daniel Billingsley | last post by:
Today I went to compile a solution I've been working on for months. I've been off most of the last few months, so there's been a gap in the work, but I did compile it a few times earlier this...
1
by: Joel Finkel | last post by:
Folks, I am unable to execute any ASPX files on a Windows 2000 Server, running as a Primary Domain Controller. The error is "Error BC31019: Unable to write to output file '<filename>'" By...
1
by: ewoiruweo | last post by:
After installing .net framework on a 2000 server for the first time this message appears when trying to open a basic default.aspx page: BC31019: Unable to write to output file...
1
by: michelevirgilio | last post by:
Hi, some hours ago my .net framework has stopped working, WITHOUT ANY REASON: no new installations, etc. Now every aspx page give me the error: Description: An error occurred during the...
1
by: Kishor | last post by:
Hi, I have developed an assembly, now it the the time to build the setup for assembly. I have created Setup project. I have added necessary files, created shortcuts... etc. when I started build,...
0
by: IKdev | last post by:
Hi all, I have win2003 server and NET 1.1 framework. Created simple ASP .NET app with one page that has button and a label. When trying to run got the CS0016 error (see below). My temp env....
7
by: dlbuller | last post by:
Hi, I apologize if this question has been asked already. I have searched with no luck. I am trying to output a specifically formatted text file and then change the extension to another program...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.