Link to home
Create AccountLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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

Hi

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)
        Try

            Dim sSQL As String

            If Status = "Unpaid" Then
                sSQL = "Select * From [Supplier Totals Unpaid]"
            ElseIf Status = "Paid" Then
                sSQL = "Select * From [Supplier Totals Paid]"
            Else
                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()
            connection.Open()
            dataadapter.Fill(ds, "Suppliers_table")
            connection.Close()
            DataGridView_Supplier.DataSource = ds
            DataGridView_Supplier.DataMember = "Suppliers_table"

            Total_Supplier_Boxes()

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

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
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.
Avatar of Murray Brown

ASKER

Thanks very much