Click here to Skip to main content
13,096,268 members (52,892 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have one database file "ABC.mdb" that is in DATABASE folder..This database folder is in Projects folder "Milkat"...Now what I need is,this MILKAT named folder can be placed on any drive..On Windows server 2003,The code I used runs perfect but when I copy on clients PC the same folder,error occurs saying "File not found".Below is the code to Find path of file and store it in variable..
'If IO.File.Exists("..\..\Database\ABC.mdb") Then
        '    PathDB = "..\..\Database\ABC.mdb"
        '    MsgBox("This path does not contain database.")
        '    Exit Sub
        'End If

Please help me..
Posted 21-Mar-13 1:06am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This error is caused by the use of relative paths, I suppose. Check if the relative path of the DB is the same on the client system and on the development folder.

Marco Bertschi
Rachna0309 21-Mar-13 7:27am
On development PC it is,E:\Projects\Database\ABC.mdb
and On Client system it is,C:\Milkat\Database\ABC.mdb
Marco Bertschi 21-Mar-13 7:29am
And where is the executable located?
Rachna0309 21-Mar-13 7:31am
On clients PC it is in C:\Milkat
On development it is in E:\Projects\bin
Rachna0309 21-Mar-13 7:36am
Is there any better way to get path of file??
Marco Bertschi 21-Mar-13 7:37am
The Problem is that your exe is located on different places related to the database on client and dev machine.
Changing the exe's location to C:\Milkat\bin on the client machine should you help solving the problem.
Rachna0309 21-Mar-13 7:40am
But as far as I know,relative path means we dont need to specify all folders name
Marco Bertschi 21-Mar-13 8:15am
Yes. But in your case, the realtivity of the exe and the DB has changed. Your exe is looking for the db at "C:\Milkat" and not "C:\Milkat\Database" on the client machine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 21 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100