Hi I`m quite a beginner in MS access and VBA and I`m currently having the problem to export data from an SQL server into a table. I managed to open a recordset but I`m incapable of adding the recordset to an existing table.
I found similar threads but I am still not able to generate functioning code.
This is the code I have so far and I would appreciate any help.
Thanks!
I found similar threads but I am still not able to generate functioning code.
This is the code I have so far and I would appreciate any help.
Code:
Function fDAOServerRecordset()
Dim db As DAO.Database
Dim dblcl As DAO.Database
Dim rssql As DAO.Recordset
Dim strConnect As String
Dim strSQL As String
'With integrated security
strConnect = "ODBC;DSN=FIS-DW;Trusted_Connection=Yes;DATABASE=FIS_DW"
strSQL = "SELECT [Base_Barcode] FROM [tablesamples]"
'Open the database and recordset
Set db = DBEngine.OpenDatabase("FIS_DW", False, True, strConnect)
Set rssql = db.OpenRecordset(strSQL, dbOpenSnapshot)
'This is where I am stuck! I would like to insert the data into an existing table
db.Close
Set rst = Nothing
Set db = Nothing
End Function
Thanks!