Solved

RUN TIME ERRO 52

Posted on 2010-09-17
6
518 Views
Last Modified: 2012-05-10


Run-time error '52'

Bad file name or number

On debug highlighted on following line
Open csvflname for output as #iFileNo


Dim iFileNo as integer
dim csvflname as integer

csvflname = text1(8) & ".csv"

Open csvflname for output as #iFileNo

Open in new window

0
Comment
Question by:crystalsoft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 13

Expert Comment

by:AielloJ
ID: 33700510
crystalsoft:

Where is the varible 'text1' initialized?  Try printing csvfilename and text1 for debug purposes.

AielloJ
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 33700554
Make sure that csvflname = text1(8) & ".csv" contains a valid name and not something like this ".csv"
Check the value of text1(8)
0
 
LVL 1

Author Comment

by:crystalsoft
ID: 33700566

Thanks for quick reply sir

text1(8) is a text box

csvflname = text1(8) & ".csv"

on debug i am getting file name like 43.csv

43 is value from text1(8)
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 40

Assisted Solution

by:Kyle Abrahams
Kyle Abrahams earned 125 total points
ID: 33700598
does 43.csv exist?

try text1(8).text

see this link:
http://www.experts-exchange.com/Programming/Misc/Q_26474347.html
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 125 total points
ID: 33700601
What is the value of #iFileNo ?

Perhaps you need to add something like this:

#iFileNo = freefile()
Open csvflname for output as #iFileNo
0
 
LVL 14

Expert Comment

by:VBClassicGuy
ID: 33702367
Just an observation no one picked up on, and something to watch out for in the future. In your original posted code, you declared csvflname as an integer, then assigned a text value to it. That's a no-no.
Fixing that and setting iFileNo with FreeFile would have made the code work (assuming text1(8) is a valid control on your form).
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question