VB.net Will running a query in Access automatically run sub queries

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

I have a VB.net 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:Murray Brown
LVL 85

Accepted Solution

Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 36923401
Do you mean queries that are used to build the top-level query? If so, then yes, it would.

Expert Comment

ID: 36923562
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

by:Murray Brown
ID: 36923772
Thanks very much

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

807 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