Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Sep 11, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Connecting to an Access DB on a Server

I want to connect to an Access DB on a server from a client using a VB app. I assume I would have to make a connection to the database on the server. How could I do this? Would I need to return a recordset from the sever via ADO?

For Access, you have to specify a directory and filename in your ADO connection string. That means that the directory where the file is located needs to be mapped as a network drive on your computer. Once you've done that, you can create your connection string like this:

Dim cnDB As New ADODB.Connection
cnDB.ConnectionString = _
   "Provider=Microsoft.Jet.OLEDB.4.0;" _
   & "Data Source=F:\MyDB.mdb"

You can then get recordsets or whatever else you need from the database. If you're using Access 97, use OLEDB.3.51 instead of OLEDB.4.0 in the connection string.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date