Run Action Query with VB.NET

Posted on 2005-05-09
Last Modified: 2008-01-16
I created an action query in MS Access and i would like to run that same query from VB.Net.  Since I need to run the code in multiple spots in my application, I would like another alternative than:

dim myStr as string = "Update ....."
dim myCmd as new command(mystr, myConnection)

Question by:rodmjay
    1 Comment
    LVL 14

    Accepted Solution

    If you have several forms, you can put the method in a module, so it's global and can be accessed within the whole program.

    Module Module1

        Public Sub UpdateDb(ByVal myConnection As OleDbConnection)
            dim myStr as string = "Update ....."
            dim myCmd as new command(mystr, myConnection)
        End Sub

    End Module

    You can call UpdateDb(myConnection) from anywhere inside the application.

    If you only have one form, then write it as a method, and call it from other subroutines.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Article by: Kraeven
    Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now