Hi,
I am creating a small application which connects to an MS access database.
I am using app to get the path of the mdb. This works fine when I am accessing the exe from my own machine.
When I share the folder containing the exe and access it over the LAN, app looks for the mdb in the client machine. How do I reference the mdb on server?

Following is the code for db connection:

'Module to connect to the database.
Sub db_connect()
Dim AccessConnect As String
Dim sPath As String

sPath = App.Path & "/../MasterDB"

AccessConnect = "Driver={Microsoft Access Driver (*.mdb)};" & _
                     "Dbq=My_Master.mdb;" & _
                     "DefaultDir=" & sPath & ";" & _
                     "Uid=;Pwd=test123;"
                     
con.ConnectionString = AccessConnect
con.Open
End Sub

Can anyone please guide me ahead?
Regards,
ss

instead of sPath = App.Path & "/../MasterDB"
use sPath = "\\SERVER\...\MasterDB.MDB"

Thanks Dilip. I tried this. Didn't seem to work. :(
I am thinking of using a config file to get the path. Couldn't find any other way.
Regards,
ss

config file is the best way to get the path. You can read file easily

Have you ever tried the WINSOCK component?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.