␡
- User Features
- Developer Features
- Multitable Selection
- How It Works
- Enhancements
- Wrap Up
Like this article? We recommend
Multitable Selection
The example program uses the code shown in Listing 2 to display order records. To display the name of the company that placed each order, the form joins the Customers and Orders tables, essentially performing this query:
SELECT OrderID, Company, DateOrdered, DateShipped, DatePaid, PurchaseOrder FROM Orders, Customers WHERE Customers.CustomerId = Orders.CustomerId ORDER BY DateOrdered, DateShipped, DatePaid
Notice how the call to the Selector form's Initialize method defines the query's tables and join condition.
Listing 2 The Example Program Uses this Code to Display a List of Order Records.
' List order records. Private Sub cmdListOrders_Click() ' Create the Selector form. Set orders_selector = New frmSelector ' Define the selection fields. orders_selector.AddField "OrderID", "" orders_selector.AddField "Company", "Company" orders_selector.AddField "DateOrdered", "Ordered" orders_selector.AddField "DateShipped", "Shipped" orders_selector.AddField "DatePaid", "Paid" orders_selector.AddField "PurchaseOrder", "Purchase Order" ' Initialize the Selector form. orders_selector.Initialize m_Connection, _ "Orders, Customers", _ "Customers.CustomerId = Orders.CustomerId", _ "DateOrdered, DateShipped, DatePaid" ' Allow the user to resize the FlexGrid's entries. orders_selector.flxResults.AllowUserResizing = flexResizeBoth ' Display the Selector form. orders_selector.Show vbModal Set orders_selector = Nothing End Sub