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

ID: Q105646


The information in this article applies to:


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           : WINDOWS:1.0,1.1,3.0
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: March 28, 1999