Learn To Program With Visual Basic Databases
ActivePath
(1902-745-035)
Muska and Lipman Printing (1929-685-173)
Errata Link
Errata and FAQ's
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.
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.
Bugs
My thanks to a reader for pointing this out.
When you finish the project (Chapter 9),
you'll find that when you enter a valid order and print
the sales receipt, it clears the main form for the next customer.
If that next customer enters some china and calculates it,
says I'll take it, but then cancels on the Customer Ask form,
the transaction and sales receipt still print.
This is happening because the customer number is not being re-initialized
in the Click event procedure of the Cancel button.
Please check the fix listed for Page 511 below.
General #1---Appendix C is missing
Appendix C is missing. Download it here
or view
it here.
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
- Find DBGRID32.OCX somewhere on your installation CD-ROM.
- Copy it to \Windows\System
- Find VBCTRLS.REG somewhere on your installation CD-ROM.
- Copy it to \Windows\System
- 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. Select it to add it to your Toolbox.
- Click on the "Browse..." button.
- Locate the control DBGRID32.OCX
- 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!)
- Go to http://www.microsoft.com
- Click on Customer Sites/ Developer
- Select Visual Studio
- Select Samples & Downloads/ Product Updates
- Select Visual Basic Updates
- Download vbc.exe (this file will be needed to fix "Licenses Info error message"
displayed when running the following file.)
- Download True Data-Bound Grid (DBGrid)Control.
- 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 Shopcode
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.
Check out this link
http://support.microsoft.com/support/kb/articles/q238/4/01.asp for more information.
General #7---China Shop Project from CD Input to Chapter 10
Not an errata, but ...
If you try to execute the calculation code at the end of the
exercise that begins on Page 557, the program will bomb.
Check out the note in Step 5 of the exercise beginning on Page 557.
The work that we do in that exercise 'disables' the calculation button
until we finish up in Chapter 10.
Also, if you copy the code from the CDROM for Chapter 10 that won't help.
It also has the disabled code.
Chapter 1
- Page 29, second line. "using only with the skill-set" should be "using only the skill set"
Chapter 2
- Page 60, line six. "If you look at the bottom of datasheet view window" should be
"If you look at the bottom of the datasheet view window"
- 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 74, first line, second paragraph. "The Primary key of th Authors table" should read "The Primary key
of the Authors table"
- Page 80, fifth line. "Now in th Titles table" should read "Now in the Titles table"
- 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 96, Paragraph 11, 2nd Line -
"... don't miss out any ..."
Should be
"... don't leave out any ..."
- Page 100, line 1. Delete "the user of the" from the sentence.
- Page 100, line 3. Add an 's' to the end of staff.
- 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 143, Step 8. "select the OK button" should be "select the Create button"
- Page 152, Step 3. We're adding records to the Transactions table, not the Inventory Table.
Chapter 4
- Page 159, Line 8. "Will let us to achieve" should be "Will let us achieve"
- Page 215, The Demonstration on preventing the deletion of a record. The record
is deleted anyway. Modify to code to look like this...
Save = False
Action = vbDataActionCancel
- Page 219, line 3. "...that Joe Bullina has agreed with us" should be
"...that Joe Bullina has asked us for..."
- Page 225, the screen shot at the top of page. The Data Control should have the caption "Data1".
The caption is not changed until page 232 when it becomes "Users".
- Page 229, third paragraph from the bottom
of the page. "This will make your program will run faster".
Should be "This will make your program run faster"
Chapter 5
- Page 245. Recordset Properties table, RecordCount row, Comments column.
"For a Dynaset or recordset, ..." should read "For a Dynaset or Snapshot, ...".
- Page 253, line 6. "...chart that distributed" should be "...chart that I distributed"
- Page 255, first line of Paragraph 5. "Top demonstrate" should be "To demonstrate"
- 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. "An event is something that which happens..." should be
"An event is something that happens"
- Page 321, lines 12 and 13 reference 6 operators of the Seek Method. Actually, there
are only five.
- 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"
- Page 355, line 7. "OK button in when attempting" should be
"OK button when attempting"
Chapter 7
- Page 375, The Au_Id field in the screen shot should read '16101'
- Page 380, towards the bottom of the page. "This Cancel button will let the user to change their mind"
should read "This Cancel button will let the user change their mind"
- Page 400, the screenshot. The data control's caption is wrong - it should read "Users".
- Page 416, Exercise, step #1. The description cmdExitClick should be
cmdExit_Click.
- Page 425, line 5. "... set the Locked property of txtItemId to False in order..." should be
"... set the Locked property of txtItemId to True in order..."
Chapter 8
- Page 432, the Code sample in middle of page: mnuInventory_Click should be mnuUsers_Click
- Page 440, third paragraph. "if you are familiar with the Visual Basi Format" should read
"if you are familiar with the Visual Basic Format"
- 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 462, first paragraph, first line. "using sing the DBGrid" should be
"using the DBGrid"
- Page 473, line 7. "So why isn't on the PCs here?" should be
"So why isn't it on the PCs here?"
- Page 492, bottom of the page. "... code that the Joe's staff need to interact" should be
"...code that Joe's staff need to interact"
- Page 495, top screenshot. The menu reads View/Update Inventory but the screen
pointed to is View/Update Customers
Chapter 9
- Page 511. Add this line to the cmdCancel Click Event Procedure.
g_intCustomerNumber = 0
- Page 532, Step 12: Add a colon after Cit&y for the Caption property
- Page 577, Step 5. The function header should read: Public Function PriceLookUp(Brand, Item) As Currency
Chapter 10
- 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 ..."
- Page 591, Step 4. "...and to return an Long type value..." should be
"...and to return a Long type value..."
- 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 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!"
FAQ's
1. Using the "Yes, but I forgot" button and then the "That's me"
button on the Customer Lookup form, leaves the user somewhat "lost in space".
While it does add the transaction to the Transactions table,
it provides no customer confirmation that the order was received.
Nor does it provide a printed receipt like navigating directly through the "Yes"
button.
I've attempted to add this functionality to the "That's me" button with
no success. What do I need to do add it?
ANSWER:
Hmmm... I just ordered something via the I forgot my customer id route,
and I did get a printed receipt.
I'm working with my original copy, and also the completed project from the CD,
so there could be something wrong with the code you've entered,
or even the instructions in the book, I'm not sure.
2. If the customer chooses multiple "complete place settings",
the total is given on the China form, but the total does not appear
in the transaction table nor on the printed receipt.
Where is the likely problem?
ANSWER:
Looks OK to me---at least from my end.
When you say multiple I presume you mean more than one---
I just purchased 2 complete place settings of Corelle for a total of
$16---a $2 discount.
3. For a single "complete setting" it shows the price of the individual
components which do not add up to the total price for the 'complete setting'.
What needs to be done to correct this?
ANSWER:
That's because there's a complete place setting discount---check that out,
and I think you'll find that's the case.
4. When I initially open the China project, I am receiving a "conflicting
names" message. At one point I had inadvertantly spelled 'Transactions'
as 'Transeactions', and corrected it when I disciovered the
misspelling.
I have been receiving the 'conflicting names' message
since then. It does not affect performance, but it is annoying. How
can I correct it to make that message disappear. I've had the same
problem with other projects, and inadvertantly did "something" to
correct it but I don't know "what" I did!
ANSWER:
I'm trying to remember when this happens, and it's slipping my mind.
Can you zip me your project, and email it to me--that will enable
me to remember the problem faster.
5. I have a suggestion to enhance the next edition of this book. Perhaps
you could add an appendix on troubleshooting/debugging in a table format,
listing common problems and the most probable causes of the problem.
Having completed your first book and quite a few other VB programming books,
I was able to correct MOSTof the glitches I encountered, but not all of them.
A person with even less experience, is likely to have some difficulties correcting the
glitches that arise. A troubleshooting table would be a great addition
to the next addition of this book.
ANSWER:
Thanks---this is it!
The Number of visitors to this page since August 13, 1999
© 1998-2001, Smiley and Associates, Inc.
Revised - March 16, 2001
webmaster@johnsmiley.com
[ Home
| Books
| Links
| My book!
| Smiley and Associates
| Visual Basic
]