Solved

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

Posted on 2003-10-28
4
147 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
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 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

22 Experts available now in Live!

Get 1:1 Help Now