chianta
chianta

Reputation: 123

Get records from Access table

On Access 2010 I need to use VBA to get the records in a table, process them and put them in a new table. Could you tell me how can I do?

Is there a way similar to C # to put everything into a datatable the result of a query?

I found an example on how to get the data. http://pastebin.com/bCtg20jp

But it always fails on the first statement "ADODB.Recordset". I went to see the included libraries and library that uses ADODB is already included "Microsoft Access 14.0 Object Library".

Upvotes: 0

Views: 1441

Answers (1)

HansUp
HansUp

Reputation: 97101

When you said '... always fails on the first statement "ADODB.Recordset". I went to see the included libraries and library that uses ADODB is already included "Microsoft Access 14.0 Object Library"', I think you meant this line in the pastebin code ...

Dim rstEmployees As ADODB.Recordset

But ADODB is not provided by the Access Object Library. You need to include a reference for ActiveX Data Objects. This screenshot is from Access 2007. I don't recall which ADODB versions are available in Access 2010. If in doubt, try the highest version number from the choices Access offers.

enter image description here

I'm uncertain how many other hurdles you will encounter after this. One point which confuses me is that your question asks about VBA but your pastebin code is tagged for VB.Net ... as long as you understand the differences between them you may be OK. Good luck.

Upvotes: 2

Related Questions