?
Solved

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

Posted on 2003-10-28
4
Medium Priority
?
152 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 720 total points
ID: 9632775
App.Path is not finished by "\". Try

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

Assisted Solution

by:crazyman
crazyman earned 120 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 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…
Suggested Courses
Course of the Month10 days, 3 hours left to enroll

762 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