Question Locked

Visual Basic - Connecting to Access 97 Database Problem

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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

3 replies

by robo_dev

shouldn't it be

conn.open varConn

For example:

using "connect" as my variable...

Connect="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & MDBFile & ";"

Conn.Open Connect

by martinbullock15

Well after spending the weekend looking at why this error is appearing it looks to be the reason is because the complier within VB Express 2008 is running in 64bit mode and i needed to get Visual Studios to allow me to run the compile in 32Bit mode.

This discussion is closed to new replies.