954,224 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How can i access data from MS Access using VB6 (I need the connection code)

How can i access data from MS Access using VB6 (I need the connection code) can u plz tell me the code for accessing tables in MS Access using Visual Basic 6. my access tables are in a server not in my local computer..... plz let me know the code

guru511
Light Poster
42 posts since Jul 2007
Reputation Points: 10
Solved Threads: 3
 

Hi,

Get Connection String here:

http://www.connectionstrings.com/?carrier=access

Change the Path to Server Path.

Regards
Veena

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

'using connection object

'in general section
dim conn as adodb.connection
dim rs as adodb.recordset

'in form load
set conn=new adodb.connection
set rs=new adodb.recordset

conn="provider=microsoft jet.4.0.oledb;data source=;persist security info=false"
conn.open
rs.open "select *from ur tablename",conn,adopendynamic,adlockoptimistic

choudhuryshouvi
Posting Pro
553 posts since May 2007
Reputation Points: 30
Solved Threads: 49
 

will this work for a database which is in a server not in my local computer

guru511
Light Poster
42 posts since Jul 2007
Reputation Points: 10
Solved Threads: 3
 

thanq mr.choudhuryshouvi

will that work for a database which is in a server not in my local computer...

guru511
Light Poster
42 posts since Jul 2007
Reputation Points: 10
Solved Threads: 3
 

Hi,,

Add "Microsoft ActiveX objects 2.0" References to the project. Share the Folder in Server With Full Access.
use this code:


Dim rs As New ADODB.Recordset
Dim AC As New ADODB.Connection
With AC
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\ServerName\ShareFolder\db1.mdb;Persist Security Info=False"
.Open
End With
ssql = "Select * from MyTable"
Set rs=Nothing
RS.Open ssql,AC

REgards
Veena

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

Thanq very much veena
guru

guru511
Light Poster
42 posts since Jul 2007
Reputation Points: 10
Solved Threads: 3
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You