VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This code opens a table in an access database using a SQL statement.

by Glenilo Geraldizo (2 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 2nd February 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This code opens a table in an access database using a SQL statement.

API Declarations


dim rs as new adodb.recordset

Rate This code opens a table in an access database using a SQL statement.



'assume that the table name is table1
'assume that the database is located in the folder
'where the application is located

'paste this code on the Form_Load event

cn.open "provider = Microsoft.Jet.OLEDB.4.0; Data Source =" & app.path & "\sample.mdb"
with rs
    .activeconnection = cn
    .cursortype = adopendynamic
    .locktype = adlockoptimistic
    .source = "select * from table1"        'this is to select all records from the table
    .open
end with

Download this snippet    Add to My Saved Code

This code opens a table in an access database using a SQL statement. Comments

No comments have been posted about This code opens a table in an access database using a SQL statement.. Why not be the first to post a comment about This code opens a table in an access database using a SQL statement..

Post your comment

Subject:
Message:
0/1000 characters