Question

Locked

Visual Basic - Connecting to Access 97 Database Problem

By martinbullock15 ·
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 conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

I could be wrong but

by robo_dev In reply to Visual Basic - Connecting ...

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

Collapse -

Looks the problem is 64Bit

by martinbullock15 In reply to Visual Basic - Connecting ...

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.

Back to Software Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums