Hello techyv,
How to connect vba access 2010?
I would like to connect my visual basic 6 calculator system in Microsoft Access 2010 database.
I need a database that will hold all the possible data to be entered and save by the system user.
Can you give me a step by step process on how to connect it properly?
This is for my office database.
Expecting some help from you guys.
Thank you.
How to connect vba access 2010?
Hi,
To connect to VBA in access 2010,you need to use the code below:
Dim sSQL As String
Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=S:MyFoldermyDB.accdb;Persist Security Info=False"
sSQL = "Select top 2 from Table1"
Set rs = New ADODB.Recordset
rs.Open sSQL, cn
ActiveWorkbook.Sheets("Control").Cells(6, 1).CopyFromRecordset rs
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
If there are any errors, use the following code in rs Run-time error '-2147217900 (80040e14)': Automation error and you want to VBA for Access 2010 to SQL 2008 R2 just visit this link:
Thanks, Max