Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

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



Application Security Testing: An Integral Part of DevOps

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