Database A Database contains a collection of Tables A Table is used to store information in a logical format Example: Addresses from an address book would be stored in a table A Table contains a collection of Records Records are related information for a specific item Example: A specific address A Record contains a collection of Fields A Field is a piece of information about the record Name Street Address City State Zip Code Phone Number ADO Data Control (ActiveX Data Objects) Connects to specific table in a database 1. Specify the ConnectionString tells us where the database is and how to connect to it 2. Specify RecordSource property tells us which table to use Bound Data Controls (Label, TextBox) 1. Specify DataSource (ADO Control) 2. Specify DataField (field in the table) Manipulating Records directly in code Referred to as Recordsets instead of Tables still a collection of records Operations on recordsets Edit operations on a recordset AddNew: Appears as an asterisk on control lets you add a new record CancelUpdate: lets you remove a record if it hasn't yet been saved Update: saves the record to the databse. Delete: removes the record from the database Navigation on a recordset MoveFirst: |< MoveNext: > MoveLast: >| MovePrevious: < Properties EOF = end of file BOF = beginning of file Private Sub Form_Load() Dim intIndex As Integer Dim rsCole As ADODB.Recordset Set rsCole = frmPatron.adoCole.Recordset Do While Not rsCole.EOF intIndex = rsCole.Fields("fldSeat") - 1 lblSeat(intIndex).BackColor = vbRed rsCole.MoveNext Loop Set rsCole = Nothing End Sub Form methods Load - brings form into memory Show - loads form if not loaded, shows form on screen Hide - removes form from screen, keeps it in memory Unload - remove from screen if visible, removed from memory