Article ID: 110753
Article Last Modified on 10/29/2003
APPLIES TO
- Microsoft Visual Basic 3.0 Professional Edition
- Microsoft Visual Basic 3.0 Professional Edition
This article was previously published under Q110753
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:
- 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.
- In the Data Manager, choose New Database from the File menu and select Access 1.1.
- Click the New button and enter tbl1 for the table name.
- Click the Design button. Then click the Add button. Enter fld1 for the Field Name and select Integer for the Field Type.
- 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
- Start a new project in Visual Basic. Form1 is created by default.
- Create a Visual Basic database (or Microsoft Access database) as described above. Name this database TEST1.MDB.
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.
- To run the program, choose Start from the Run menu, or press the F5 key.
- 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 query words: 3.00
Keywords: KB110753