Solved

OPEN File with app.Path fails when application is installed on server

Posted on 2003-10-28
4
150 Views
Last Modified: 2010-05-01
I try to read an ascii file with the

Open filelocation for Input as #1

the file is located were the application is located. In this case it is located were my VB project file is located.
I am working from as server so it is located on the server.

In order to get the exact pathway I get the filelocation by calling

filelocation = App.Path & "File"

This then looks like:
 filelocation  = "//SERVERNAME\Research\VB-programme\hran\eval\master\test.cnf"

When I call
Open filelocation for Input as #1
it then comes up with the error message:
[Run Time Error 53  File not found]

I then tried to assign filelocation with the path it is showing in the EXPLORER task bar. Because the Server drive is mapped it comes up with the following:
"X:\Research\VB-programme\hran\eval\master\test.cnf"

Whe I then assign:
filelocation ="X:\Research\VB-programme\hran\eval\master\test.cnf"

all works fine and the programme finds the file.

How can I find the file by using the App.Path comand???? Because I need to use this command !
0
Comment
Question by:themroc
[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
4 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 180 total points
ID: 9632775
App.Path is not finished by "\". Try

App.Path & "\" & ...
0
 
LVL 13

Assisted Solution

by:crazyman
crazyman earned 30 total points
ID: 9632877
This is also bad...

Open filelocation for Input as #1

should be

dim lFile as long
lFile = freefile
Open filelocation for Input as #lFile
0
 

Author Comment

by:themroc
ID: 9632937
thanks AlexFM, I was sure I tried it before but apparently I did not, because it works fine now.
thankd a lot.
Also some Points for crazyman, why is writing #1 so bad, I imagine it canbe that it can cause conflicts with other open files and freefile does only assign exactly the number which is available.

Would be nice if you could comment on this


:)
themroc
0
 
LVL 1

Expert Comment

by:mahesh_mp
ID: 9632957
hello  themroc

i think you are modifiying your app.path

because your path cannot have back slesh "//" it should be fornt slesh "\\"

your file location
filelocation  = "//SERVERNAME\Research\VB-programme\hran\eval\master\test.cnf"

this can work
filelocation  = "\\SERVERNAME\Research\VB-programme\hran\eval\master\test.cnf"



0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

733 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