Creating a database: – Before using a database on the form we must create a database. This database work as DAO. This database work similar to Microsoft access. It contains number of data field such as text, memo, number, date/time, currency, auto number, logical and OLE Object.

Visual data manager, application that is included with visual basic allow us to create database. To open and create a database with visual data manager, follow the following step –

  1. Start visual basic and click add-Ins on the menu bar. A list of menus option appears, select visual data manager.
  2. A visual data manager window will open. Click file on the menu bar, then click new on the file menu. A sub menu opens. Click Microsoft access. Another sub menu opens. Click version 7.0 MDB. The select Microsoft access database to create dialog box appear. Use the dialog box to locate a folder where we wish to save the database file. Enter file name, visual data manager automatically saves the file with .MDB extension.
  3. Now we will add a table to database file. Right click in the database window. On the popup menu that appears, click new table. The table structure dialog box appears.
  4. Type table name is the table name text box. Now table is saved in .DBF file extension.
  5. Click the add field button in the table structure dialog box. The add field dialog box will appear. In the name text box, type field name and in the type list box, select a field type. Click OK button to select the field.
  6. The add field dialog box still display. Type another field name and field type and click OK button every time.
  7. After adding last field, click the close button on the add field dialog box. The table structure dialog box reappear. In this dialog box, we can edit in field structure.
  8. Click the build the table button to build the table and add it to database. The visual data manager window should appear all screen. Notice that on entry for the table new appear will appear.
  9. Now we are ready to add data to the table. Right click the table name entry in the data base window and select open from the popup menu.
  10. Click the add button. The Dynaset add record dialog box. Should appear on screen. Enter the record value of each field and click update button.
  11. Second record is now added to the table. Add the dynaset dialog box click the add button to add the next record. Continue this procedure to add all the remaining records in the table.
  12. After we have added all the records in the table, click the close button in the dynaset dialog box.
  13. Click file on the visual data manager menu bar. On the file menu, click exit button. Now we return to the visual basic form window.