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.
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.