Visual Basic Database Tutorial - Part 2
First off, we added the FlexGrid component to our project. This is just another control - like the CommandButton or CheckBox controls - that allows us to add a bit of specific functionality to our project.
The FlexGrid control allows us to very simply display all the records currently held by the Data control. In other words, if we were to tell the Data control to look directly at the Customers table (by changing its RecordSource property to Customers), the FlexGrid would display field in the Customer table.
Because we're true database divas, we're going to get all technical now. We're going to ask the database a question in SQL and tell it to display the results in the FlexGrid. That's where the bit of code steps in.
What does the code do? It simply sets the RecordSource property of the Data control to whatever is sitting in your text box. So if the text box held the text 'Customers', it would fetch everything from the Customers table. But if the text box contained an SQL question, likewise, it will ask the question and display the results.
The second line of control then simply refreshes the Data control - which means all linked items, such as the FlexGrid - are kicked and told to update themselves.
Page 4 of 8