Desktop Project
☎️Phonebook project
VB6 MS Access database
 |
vb6 MS Access 2003 Database Design for Phonebook project
|
In this part of the tutorial we will design the database according to the VB6.0 Project Requirements, we have 3 TextBoxes and 1 Image control, so we will need 4 fields in the database table. We will create only one table because there is no need to create two, just simply like that.
Note, there are several ways to store data from Visual Basic windows application project on the hard drive, using MS-Access 2003 is one of the easiest ways to accomplish this task, considering your are creating a personal windows desktop application, also it is a very handy and effective method considering creating this application for some else (client).
If you don't have Microsoft Access 2003, then download it included in MS Office 2003 package from Microsoft. Access 2003 Database is the most well known database ever used with Microsoft Visual Basic 6.
Microsoft Access Database 2003 (*.mdb) file capacity is 2GB, of course this is nothing in comparison MS SQL Server, however, MS Access 2003 is better in case of running locally (on the same machine) while MS Sql Server is better to work on multiple machines at the same time (Networking).
In our VB6.0 example (Phone-Book), in order to design the perfect MS Access 2003 database you need to know what do you want to store and what do you want to retrieve and what is ability of the database you have (MS-Access 2003) that runs on your machine (i.e. WinXp, Win7, Win8 or Win10).
Our example is small, so, special requirements are not considered, so I choosing MS-Access 2003 as a database with VB6 to create a desktop application on Microsoft Windows Xp is a perfect choice.
Navigate to your main folder then using the mouse right-click choose from new (Microsoft Office Access Application) as shown in .......... shape (1)
Shape (1)

- Rename the files from (New Microsoft Office Access Application) to (MyBook), open [MyBook].
 |
vb6 Phonebook Database Design |
- Create new table like this, and name the new table as (Phones). Save the table.
 |
vb6 phonebook Database Design
|
Open our
VB6 Project, navigate to (Project) then (References) then from the list, choose (Microsoft ActiveX Data Object 2.8 Library or
ADO 2.8 Library) as shown in the following photo.
 |
vb6 Ado 2.8 MS Access 2003
|
Why do we use ADO 2.8 library ?
ADO 2.8 was included in Windows XP and Windows Server 2003, as part of the Microsoft Data Access Components (MDAC) 2.8. A redistributable version of MDAC 2.8 is also available; note that this redistributable version should only be installed on Windows 2000. ADO 2.8 addresses several security-related concerns:
Hard drive access is not allowed outside a trusted zone.
In cross-domain scripting involving non trusted sites, the following operations are disabled: Stream.SaveToFile, Stream.LoadFromFile, Recordset.Save, and Recordset.Open, used in conjunction with the adCmdFile flag or with the Microsoft OLEDB Persistence Provider (MSPersist).
Recordset.Open , Recordset.Save , Stream.SaveToFile , and Stream.LoadFromFile operate on physical files only. These methods now verify that file handles point to physical files only.
Source : Using ADO With Microsoft Visual Basic from Microsoft Official Website
Now we have finished designing the Database according to the logic of saving and retrieving data into/from our Phone-Book project. The Ole Object will be used to store the Picture of the friend which will be loaded in the Image (Timg) control placed on the (MainFrm
) form.
Comments