Visual Basic - Connecting to Access 97 Database Problem - TechRepublic
Question
October 1, 2010 at 07:00 AM
martinbullock15

Visual Basic – Connecting to Access 97 Database Problem

by martinbullock15 . Updated 15 years, 9 months ago

Hi

I am trying to connect to a Access 97 Database to open the database and get to data to populate certain fields but i get the following error when trying to start the connection:

COMException was Unhandled

Provider cannot be found. It may not be properly installed.

The following is my code:

Dim varConn As New ADODB.Connection
Dim varCmd As New ADODB.Command
Dim varRecSet As New ADODB.Recordset

varSQLString = “SELECT Description FROM tblProduct WHERE ProductBarcode = ‘” & varCode & “‘”

varConn.ConnectionString = “Provider=Microsoft.Jet.OLEDB.4.0;” & _
“Persist Security Info=False;” & _
“Data Source = C:\DATABASE_NAME.mdb”

varConn.Open() <--- Error's Here varCmd.CommandText = "tblProduct" varCmd.CommandType = ADODB.CommandTypeEnum.adCmdTable varRecSet.CursorLocation = ADODB.CursorLocationEnum.adUseClient varRecSet.CursorType = ADODB.CursorTypeEnum.adOpenStatic varRecSet.Open(varSQLString, varConn, ADODB.CursorTypeEnum.adOpenStatic) I am using VB 2008 Express on a Win7 64Bit computer. I would be very grateful for any help and i will provide any further information as required. Kind Regards

This discussion is locked

All Comments