Solved

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

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

729 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