PDA

View Full Version : OLEDB is trying to kill me



jailin
05-24-2016, 08:09 PM
Ok I have been beating my head against this form/search method for about 4 days. Everything I have found tells me to make a connection to the DB using ADODB and use OleDb and DataSet to take the SQL query and output it.

Code:



Private Sub butSearch2_Click()
Dim CON As New ADODB.Connection 'Database Connection object

Dim dbProvider As String 'Database Provider
Dim dbSource As String 'Data Source

Dim strSEARCH As String 'SQL Search Term String
Dim SQL As String 'SQL Command

Dim DS As New Dataset
Dim DA As oledb.OleDbDataAdapter


MsgBox (OK)


dbProvider = "PROVIDER=Microsoft.ACE.OLEDB.15.0;"
dbSource = "C:\Smart\SMART.accdb"

'Open connection to the Database
CON.ConnectionString = "PROVIDER=Microsoft.ACE.OLEDB.15.0;data source='C:\Smart\SMART.accdb';"
CON.Open (CON.ConnectionString)

DA = New OleDb.OleDbDataAdapter(sql, con)



OleDb.OleDbDataAdapter(sql, con) always throws up a "Expected end of statement" error, even though every reference online shows that the structure of the line is correct.

I THINK OleDB is missing from my Lappe. When trying to type the strings into VBA, OleDB is not in the auto-complete (whatever that drop-down list is called) list. When trying the long way of System.Data.OleDb - Data isn't in the auto-complete/drop-down.

I have tried updating .NET then rebooting, installed the AccessDatabaseEngine2010 from Microsoft and rebooted,I'm currently downloading the 2016 run times to see if that will help.

I have added every refernce that looks like it might be connected to System.data or OleDB but I am out of ideas. Please help.

SamT
05-25-2016, 08:41 AM
Bump

jonh
05-25-2016, 02:31 PM
Bump

Why did this need bumping? It was already top of the list.

jailin
05-25-2016, 06:37 PM
This is an Access issue. I'm using an Access DB, using VBA from within Access and not using Visual Studio or VB.Net. I said I updated my .NET framework and ADE to make sure I had the correct DLLs to reference within VBA.

I cannot use or don't have on my lappe, OleDB. Even though the code is correct it throws errors like "User-defined type not defined" and "Expected end of statement".

Edit: I also do not that the Data parameter when trying to use System - System.data - .Data does not show in the controls drop down.

SamT
05-25-2016, 07:00 PM
@ jonh,

Why did this need bumping? It was already top of the list.
It was at the top of your list.

The forum software is very personalizing of lists. Not only was this post not at the top of my list, it was way down the list of posts I had seen but ignored.

I bumped it because I am a moderator and felt that it was in the best interest of VBAExpress to do so.