ACC1x: How to Use a Microsoft Access Database in Visual Basic

Last reviewed: May 14, 1997
Article ID: Q105646
The information in this article applies to:
  • Microsoft Access versions 1.0 and 1.1
  • Microsoft Visual Basic for Windows, version 3.0

SUMMARY

Microsoft Visual Basic version 3.0 for Windows incorporates the Microsoft Access version 1.1 engine and shares dynamic-link library (DLL) files with Microsoft Access. Therefore, Visual Basic can use Microsoft Access database (.MDB) files.

Microsoft Access creates a system database (SYSTEM.MDA) file that stores important security information such as user names and accounts. The system database file can be changed only in Microsoft Access. The Visual Basic database engine does not require a system database file unless it interacts with an .MDB file that has the security features enabled.

MORE INFORMATION

If security for an .MDB file is enabled, the Visual Basic application must run the SetDefaultWorkspace statement before the Visual Basic engine is initialized. The SetDefaultWorkspace statement will set the User ID and password. If the User ID and password are not set, the Visual Basic application will access the .MDB file as a user in the Users group.

You can set the location and name of the system database file to be used by the Visual Basic database engine by changing the SystemDB parameter in the [Options] section of the VB.INI file. The sample VB.INI section below demonstrates how to use the MYAPP.MDA system database file in the MYAPP directory:

   [Options]
   SystemDb=C:\MYAPP\MYAPP.MDA

REFERENCES

Microsoft Visual Basic, "Professional Features Book 2," Appendix A

Microsoft Visual Basic, "Language Reference," page 520


Keywords : kbusage ScrtOthr
Version : 1.0 1.1
Platform : WINDOWS
Hardware : X86
Issue type : kbhowto


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: May 14, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.