Page 245 - Open Soource Technologies 304.indd
P. 245

Unit 10: Database Fundamentals and Connectivity Option




                               Name               DataSource        DataField

                               txtAuthID          datAuthors        Au_ID

                               txtAuthor          datAuthors        Author

                               txtYearBorn        datAuthors        Year Born

                 In addition, set the  Enabled property of txtAuthID to  False.
                 When we want a control (such as a text box) to display data from a database, the properties
                 that must be set are DataSource and Datafield. The DataSource is the name of the data control
                 on the form (it should already be configured), and the DataField is the name of the particular
                 field in the database that should be displayed in the control (this field will be in the table
                 that was chosen for the RecordSource of the data control).
                 At this point, your form should resemble the screen-shot below:





























                  4. Save and run the project. Use the arrows on the data control to scroll through the data.

                  5. On any record, change the data in the author name or year born field. Move ahead, then
                    move back to the record you changed. Note that your changes remain in effect. The data
                    control automatically updates a record when you move off of the record.
                 Questions

                  1. Connect to an Access Database Using Navigation Buttons with a Data Control.
                  2. Connect to an Access Database Using the BOFAction and EOFAction Properties of the Data
                    Control.






                                      LOVELY PROFESSIONAL UNIVERSITY                        239
   240   241   242   243   244   245   246   247   248   249   250