Learn To Program Databases With Visual Basic
6
Muska and Lipman
1929-685-173
Errata and FAQ's
(Last Updated November 22, 2003)
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
- Page 61, fourth paragraph. "...the total
number of records i the table" should be "...the total number of
records in the table".
- Page 61, third paragraph from the bottom.
"..the record pointer i in the first column" should be
"...the record pointer is in the first column"
- Page 73,Paragraph 9, Last sentence - "... I had find
it on my Student ID card" Should be "... I had
to find it on my Student ID card"
- Page 78, Third paragraph. "...allows us
to use to primary keys from separate tables..." Should be
"...allows us to use two primary keys from separate tables..."
- Page 82, Last Paragraph, 2nd sentence - "A this
point" Should be "At this point"
- Page 91, Last Paragraph, 2nd sentence from the end -
"... - this is reminder ..." should be
"... - this is a reminder ..."
Chapter 3
- Page 110. Prices in illustration table at the top of page
110 do not match prices in the inventory table on page
109. Instead of 10, 10 and 40, they should be 25, 5 and
50.
- Page 129, Step 9. The Field Size of FirstName really
should be 20.
- Page 133. The screenshot should be of the
completed Design View window for the Inventory table--instead, it is of
the Database Window.
- Page 143, Step 8. "select the OK button" should
be "select the Create button"
Chapter 4
Chapter 5
- Page 245. Recordset Properties table, RecordCount row,
Comments column. "For a Dynaset or recordset,
..." should read "For a Dynaset or Snapshot,
...".
- Page 259, paragraph 1. This procedure does not work as
stated. Having moved the scrollbar, you must click a
record in the scrolled list to reset the current record
to one in view in the grid. Otherwise, the procedure
actually reports the current record before you scrolled.
- Page 272, demo. Does not work---please do not attempt to
duplicate. Please see General #3 above.
Chapter 6
- Page 304, end of Paragraph 5.
"An event is something that which happens..."
should be "An event is something that happens"
- Page 323, Midway through the page. "ISBN, by the
way, is defined as a number in the Titles table."
should be "ISBN is defined as text in the Titles
table."
- Page 330, Statement 3 should read "Ensure that you
have two apostrophes at the end of the statment."
- Page 332, code at top of page. First line either needs a
line continuation character or the twisted arrow symbol.
- Page 347, lines 7 and 8. "you can see Access that
generated one itself" should read "you can see
that Access generated that semicolon itself"
Chapter 7
- Page 375, The Au_Id field in the screen shot should read
'16101'
- Page 400, the screenshot. The data control's caption is
wrong - it should read "Users".
Chapter 8
- Page 432, the Code sample in middle of page:
mnuInventory_Click should be mnuUsers_Click
- Page 450, Step 28 and 29 both have the Cancel Property
set to True. You can only have one command button with
the Cancel Property Set to True. The cmdExit Default
Property, not Cancel Property, should be set to True.
- Page 452. The code for the
datCustomers_Reposition() event procedure needs to have a continuation
after the “&” at the end of the line datCustomers.Caption =
“Users record “ & or a new line arrow because you get a compile
error without it.
- Page 462, first paragraph, first line. "using sing
the DBGrid" should be "using the DBGrid"
- Page 478, Step 9. The Price field should come
from the Transactions table, not the Inventory table. Price is intended to
be a historical price--not the current price of the item.
- Page 495, top screenshot. The menu reads View/Update
Inventory but the screen pointed to is View/Update
Customers
Chapter 9
- Page 510 and Page 517. The code for the
varResult = needs to have a continuation after the “&” at the end of
the line varResult = Msgbox (“Are you “ & or a new line arrow
because you get a compile error without it. The same is true for the next
line datCustomers.Recordset.Fields(“FirstName”) &.
- Page 511. Add this line to the cmdCancel Click Event
Procedure.
g_intCustomerNumber = 0
- Page 534, Step 12: Add a
colon after Cit&y for the Caption property
Chapter 10
- Page 577, Step 5. The function header should read: Public
Function PriceLookUp(Brand, Item) As Currency
- Page 583, last paragraph. "...In this version of the
program, we don't need to access the values in those
variables from procedures on this from, so ..."
should read "...In this version of the program, we
don't need to access the values in those variables from
procedures on this form, so ..."
- On pages 595/596 - The code should read ItemIdLookUp not
ItemIDLookUp, provided you properly named it on Page 591.
Either way, it won't hurt things--- VB will change the
code to look like the Procedure header--however you name
it.
- Page 609 and Page 613. The else clause of the If objChk.Tag <>
“Platter” statement currently reads 'Printer.Print
Tab(20); “1”; it should read 'Printer.Print
Tab(20); “ 1”;'. Notice the leading space before the 1. This
change causes the 1 to lineup with the rest of the numbers in the quantity
column.
- Page 613, line 5. "...similarly to some of the
..." should be "...similar to some of the
...."
- Page 614. The Sales Receipt does not indicate a Complete
Place Setting discount is in effect. Modify the code on
Page 614 in PrintSalesReceipt to look like this..."
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!
|