Solved Will running a query in Access automatically run sub queries

Posted on 2011-10-06
Last Modified: 2012-05-12

I have a project that fills a DataGridView with an Access query.
Will this automatically run any sub queriesrelated to this query.
See code below for this
Sub FillDGV_Supplier(ByVal Status As String)

            Dim sSQL As String

            If Status = "Unpaid" Then
                sSQL = "Select * From [Supplier Totals Unpaid]"
            ElseIf Status = "Paid" Then
                sSQL = "Select * From [Supplier Totals Paid]"
                sSQL = "Select * From [Supplier Totals All]"
            End If

            Dim connection As New OleDbConnection(ConnectionString)
            Dim dataadapter As New OleDbDataAdapter(sSQL, connection)
            Dim ds As New DataSet()
            dataadapter.Fill(ds, "Suppliers_table")
            DataGridView_Supplier.DataSource = ds
            DataGridView_Supplier.DataMember = "Suppliers_table"


            'Me.DataGridView_Supplier.Columns(1).Width = 25

        Catch ex As Exception
        End Try

    End Sub

Open in new window

Question by:murbro
    LVL 84

    Accepted Solution

    Do you mean queries that are used to build the top-level query? If so, then yes, it would.
    LVL 5

    Expert Comment

    Yes, your Suppliers_table will be filled with any of the queries coded according to Status. Then, the filled Suppliers_table will populate the DataGridView.

    Author Closing Comment

    Thanks very much

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Access 2010 Security Concern Pop-up 34 44
    dcount multiple criteria 19 25
    DataGridView 2 16
    Displaying on a report 2 0
    Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    745 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

    12 Experts available now in Live!

    Get 1:1 Help Now