Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CONNECT TO AN ACCESS DATABASE

Status
Not open for further replies.

5hadow

IS-IT--Management
Feb 20, 2005
2
GB
I am trying to connect to an access database (say mydb.mdb), once connected i want to run an sql statement (UPDATE) then i want to disconnect. How do i go about it?

Ive tried connecting using a couple of different methods but i can't seem to connect properly
 
Check out these FAQs:

Connect to Access Database faq222-3735

Basic Database Programming faq222-4628

How to connection, change, and retrieve from an Access Database using ADO (works with other ODBC supported DBs as well) faq222-43

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
Welcome to Tek-Tips! To get the best use of the forums please read faq222-2244.

This site has an excellent search feature and we reccommend that you take full advantage of it.

Since you new...
Add a reference to Microsoft ActiveX Data Objects (Project... References...)
Code:
Dim con As Adodb.Connection
Dim SQL As string

Set con = New Adodb.Connection

con.Provider = "Microsoft.Jet.OLEDB.4.0"
con.open "YOUR PATH HERE"

SQL = "YOUR SQL STATEMENT"

con.execute SQL

con.close

set con = nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top