Create Database with Data Manager & View w/ Text/Data Control

Last reviewed: June 21, 1995
Article ID: Q110753
The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, version 3.0

SUMMARY

This article gives step-by-step examples of the following:

  • How to create a database with Visual Basic's DATAMGR.EXE Data Manager.
  • How to view a database using a text box bound to a data control.

MORE INFORMATION

How to Create a Database Using Visual Basic's Data Manager

You can create a new database as follows:

  1. Open the Data Manager program by choosing it from the Window menu in Visual Basic or by running DATAMGR.EXE from the Windows File Manager.

  2. In the Data Manager, choose New Database from the File menu and select Access 1.1.

  3. Click the New button and enter tbl1 for the table name.

  4. Click the Design button. Then click the Add button. Enter fld1 for the Field Name and select Integer for the Field Type.

  5. Save this Microsoft Access database with the name TEST1.MDB. Close the Data Manager when finished.

You can add data to a database with the Data Manager by selecting a table and choosing the Open button. You can click Add; then enter data into the field(s) of the new record. Click Update, or click Add again to enter the next record. You can also scroll to any existing record, modify the data in any field, and then click the Update button to write the record to the table.

How to View a Database By Binding a Text Control to a Data Control

  1. Start a new project in Visual Basic. Form1 is created by default.

  2. Create a Visual Basic database (or Microsoft Access database) as described above. Name this database TEST1.MDB.

  3. Add the following controls to Form1, and set the following properties:

       Control Name  Property       New Value         NOTE
       ----------------------------------------------------------------------
       Data1         DatabaseName   C:\VB\TEST1.MDB   Database created above.
       Data1         RecordSource   tbl1              Valid table name.
       Text1         DataSource     Data1             Name of data control.
       Text1         DataField      Fld1              Valid field name.
    
    

  4. To run the program, choose Start from the Run menu, or press the F5 key.

  5. Scroll through one record at a time in the database using the data control. View the contents of the Fld1 field in the text box. Close the form to end the program.

Data Manager

By using the DATAMGR.EXE Data Manager program provided with Visual Basic, you can do all this:

  • Create a database
  • Create new tables
  • Create an index
  • Open an existing database
  • Add fields to a table
  • Modify table data
  • Delete an existing table
  • Compact a database
  • Repair a database

The Data Manager gives you a subset of the features found in Microsoft Access for Windows. Data Manager, Visual Basic, and Microsoft Access all create the same database format, an .MDB file. An .MDB file contains the database structure as well as the data itself.

The documentation for Data Manager is found in Data Manager's Help menu.


Additional reference words: 3.00
KBCategory: kbprg
KBSubcategory: APrgDataOther


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.