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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Poking around in Access tables 1

Status
Not open for further replies.

hellferret

Programmer
Mar 15, 2001
91
GB
Think I'm being a complete muppet here, but how do I play with records from an Access 2000 table from VB?
 
Use ADO -

Dim oRecordset1 As ADODB.Recordset
Dim sConnStr As String
Dim sSQL As String
Dim oConnection1 As ADODB.Connection

sConnStr = "Provider=SQLOLEDB;Data Source=MySrvr;" & _
"Initial Catalog=Northwind;User Id=MyId;Password=123aBc;"

' Create and Open the Connection object.
Set oConnection1 = New ADODB.Connection
oConnection1.CursorLocation = adUseClient
oConnection1.Open sConnStr

sSQL = "SELECT ProductID, ProductName, CategoryID, UnitPrice FROM Product"

' Create and Open the Recordset object.
Set oRecordset1 = New ADODB.Recordset
oRecordset1.Open sSQL, oConnection1, adOpenStatic, _
adLockBatchOptimistic, adCmdText

' Disconnect the Recordset.
Set oRecordset1.ActiveConnection = Nothing
oConnection1.Close
Set oConnection1 = Nothing



hope this helps!
smbure
 
Why thank you, you sexy beast.

I am overwhelmed by happiness.

Have a purple star on me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top