Solved

RUN TIME ERRO 52

Posted on 2010-09-17
6
512 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
6 Comments
 
LVL 13

Expert Comment

by:AielloJ
Comment Utility
crystalsoft:

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

AielloJ
0
 
LVL 53

Expert Comment

by:Dhaest
Comment Utility
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
Comment Utility

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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 39

Assisted Solution

by:Kyle Abrahams
Kyle Abrahams earned 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now