Access query in 2010

1. I am new to My question is: can you run querys from an access database 2010 from , if so can someone explain to my how?

2. Can you do the same with macros? if so how.

3. I will need to do the following with-in
Add a record
update record
delete record

I will need some examples. Please help.
Who is Participating?
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
The only way to run a Macro would be through automation. I'd strongly advise against doing that, and instead move your Macro logic to .NET code (otherwise what's the point of doing this in .NET?).
There are 2 primary ways that you can interact with an Access db from .NET.  1) Use ADO.NET to run SQL statements against the db as a backend. 2)  Use Access automation to run Access as an application an have the Access application do the queries, etc.

Option 1 is generally preferred  when possible.  However for doing very Access specific things like running Access macros, interacting directly with Access forms and reports you need option 2.

For adding, updating, and deleting records option 1 is would usually be the way to go.

There are many specific examples of interacting with databases of all sorts using VB.NET and ADO.NET.  If you could give a little more info on what you are trying to do it would be helpful.  For instance, web or windows app?  Do you need to see/manipulate the data you are updating/changing?
PoppygbAuthor Commented:
I wish I could get some code examples or a good book that goes more into detal.
Other wise GOOD WORK
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Here's a link on automating Access from .NET:

You need a Reference to the Access library, and then you do this:

Dim oAccess As Access.Application
oAccess = New Access.ApplicationClass
oAccess.OpenCurrentDatabase("Path to your db")

'/ now use the oAccess object:
oAccess.Docmd.RunMacro "YourMacroName"

'/ be sure to close the object:
oAccess = Nothing
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.