Learn To Program Databases With Visual Basic 6

Muska and Lipman

1929-685-173

Errata and FAQ's
(Last Updated November 22, 2003)

Errata list

Every author endeavors for perfection. My apologies for the typos that have slipped through. We'll do our best to have these corrected for the next printing.

General #1---Unexpected Error--call John Smiley

This happens when you copy the completed China Shop Project (either the one on the CD or one you downloaded somewhere) to your hard drive and try to run it. The reason for that is that the program is 'hard coded' to run from only one location (you'll learn how to fix this in the Objects book using the Path property of the App object).

At any rate, the program can only run from this location

            C:\VBFILES\CHINA

so make sure you copy the files there. Any other location will cause this problem. And after you copy the files, make sure they are NOT marked Read-only--something that happens when you copy from a CD.


General #2--Where is the DBGrid32.OCX?

Not an errata, but a potential problem for some readers. 

The DBGrid32.OCX that I use in the book for demos is not automatically installed for VB6 Pro and Enterprise versions, and is non-existent on VB6
Learning Edition and Working Model Editions. 

For those of you with Pro and Enterprise, here's what you need to do to get the control in your Toolbox 

1. Find DBGRID32.OCX somewhere on your installation CD-ROM. 
2. Copy it to \Windows\System 
3. Find VBCTRLS.REG somewhere on your installation CD-ROM. 
4. Copy it to \Windows\System 
5. Use Windows Explorer and double click on VBCTRLS.REG---that will register DBGRID32.OCX. You should now see the control when you select

Project-Components

6. Select it to add it to your Toolbox. 
7. .Click on the "Browse..." button. 
8. Locate the control DBGRID32.OCX 
9. Double Click to add it to Project-Components. 

For those of you with Working Model and the Learning Edition, here's what you need to do to get the control in your Toolbox (this method courtesy of Bob Stallings---I hope it works for you!) 

1. Go to http://www.microsoft.com 
2. Click on Customer Sites/ Developer 
3. Select Visual Studio 
4. Select Samples & Downloads/ Product Updates 
5. Select Visual Basic Updates 
6. Download vbc.exe (this file will be needed to fix "Licenses Info error message" displayed when running the following file.) 
7. Download True Data-Bound Grid (DBGrid)Control. 
8. Installing the above should give you access to the DBGrid Component as needed. 


General #3---Last Updated Property doesn't work


In the book I cite the LastUpdated Property of the Recordset as a way to determine the date and time that a Table type Recordset was last updated. 

In reality, this returns the Date and Time that the Table was structurally modified. My apologies.

To obtain the date and time that a Table was last updated, use this code 

MsgBox "Table last updated on " & FileDateTime(App.Path & "\test.mdb") 

For more info on the various types of DAO Recordsets, see this Microsoft knowledgebase article on 

Recordset Differences 


General #4--Error Handler in original China Shop code

There's a bug in the Error Handler for the load procedure of the main form. 

If the PRICES.TXT file is not found, we detect it properly, but we wind up generating a cascading form load event. To correct that, you need to follow these steps in the Load Event Procedure of the Main form. 

After executing the line of code reading 'Unload frmMain' we should also execute the 'End' statement. Like this: 


Unload frmMain
End
Exit Sub

General #5---Can't update program

Not an errata, but ... 

If you copy the sample files from the enclosed CD-ROM to your hard drive, most likely they will be marked read-only. 

When you try to access the China Database, you'll receive an error message that reads 

The Microsoft Jet database engine cannot open the file "C:\VBFiles\China\China.mdb". 
It is already opened exclusively by another user, or you need permission to view its data." 

To fix this, all you need to do is open up the Windows Explorer, select the China Shop Database, then right click your mouse to bring up the Properties
Window. Un-check the read-only attribute, and you should be fine. 


General #6---Access 2000 issues

Not an errata, but ... 

If you try to connect to an Access 2000 Database via Visual Basic, you're going to have some problems. 

Service Pack 4 (and 5) for VB6 corrects this error. 

You can download Service Pack 5 from 

http://msdn.microsoft.com/vstudio/downloads/updates/sp/vs6/sp5/default.asp

One word of caution. If you start a project with the Data Control, then download and install the Service Pack, you will need to delete the Data Control then add it back in order to see the changes.


Chapter 1

None that we know of


Chapter 2


Chapter 3


Chapter 4


Chapter 5


Chapter 6


Chapter 7


Chapter 8


Chapter 9

    g_intCustomerNumber = 0


Chapter 10

Printer.Print "The total price of your order is ";
Printer.Print Format(m_curTotalPrice, "currency");
If chkChinaItem(0).Value = 1 And _
   chkChinaItem(1).Value = 1 And _
   chkChinaItem(2).Value = 1 And _
   chkChinaItem(3).Value = 1 And _
   chkChinaItem(4).Value = 1 Then
   Printer.Print ". (Price includes a Complete Place Setting Discount) "
End If
Printer.Print
Printer.Print "Thank you for your business!"

 

The Number of visitors to this page since January 15, 2001


© 1998-2002, Smiley and Associates, Inc.
Revised - November 17, 2002

webmaster@johnsmiley.com

[ Home | Books | Links | My book! |