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.
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.
Not an errata but..
I recently received this email from a reader---many thanks, as he answered a question that has been troubling several readers
Professor Smiley, I ran into a problem while working through your Learn to Program Objects with Visual Basic 6 book. It has to do with creating Word applications. I used about every variation imaginable to create the Word.Application object. Everything I tried resulted in the same error message, "Error: 429, ActiveX component can't create object". I should mention that I'm running Office 2000 on a Windows 2000 machine. I spent days trying to figure out what was wrong. I tried re-installing Word, replacing MSWORD9.OLB (the Microsoft Word 9.0 Object Library file), downloading an Office Registry Repair utility from Microsoft (which interestingly, worked twice before giving me the error message), everything I could think of. Then I ran across someone else who had encountered a similar problem in one of the newsgroups. As it turns out, the problem occurs when you also have Norton Anti-Virus running. I had to unregister NAV (regsvr32 /u "c:\program files\navnt\officeav.dll"), then everything worked fine. What a relief! I just thought I'd pass this along in case you get any inquiries from students experiencing similar problems.
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
None that we know of
The code was going in the right direction--- assigning the text property to a variable and using the value of the variable in the comparison expression for each of the If statements is more efficient code-- as each 'read' of a property requires two Input-Output operations. Looks like I started to do that, and didn't follow through.
m_sngFinalGrade = stuNew.Average
If Len(App.Path) = "3" Then
Page 355, the Error Handler. Add
End
after
Unload frmMain
MsgBox Err.Number & ": " & Err.Description
' Check to see if any of the Dish types are instantiated...my change to the code on pg 374
If Not m_dshPlate Is Nothing
Then
curPlatePrice = m_dshPlate.Price
Else
curPlatePrice = 0
End If
If Not m_dshButterPlate Is
Nothing Then
curButterPlatePrice = m_dshButterPlate.Price
Else
curButterPlatePrice = 0
End If
If Not m_dshSoupBowl Is Nothing
Then
curSoupBowlPrice = m_dshSoupBowl.Price
Else
curSoupBowlPrice = 0
End If
If Not m_dshCup Is Nothing Then
curCupPrice = m_dshCup.Price
Else
curCupPrice = 0
End If
If Not m_dshSaucer Is Nothing
Then
curSaucerPrice = m_dshSaucer.Price
Else
curSaucerPrice = 0
End If
If Not m_dshPlatter Is Nothing
Then
curPlatterPrice = m_dshPlatter.Price
Else
curPlatterPrice = 0
End If
Page 385, 3 lines from the bottom. "Shorly, we'll be remove all.." should be "Shortly, we'll be removing all..."
If Len(App.Path) = "3" Then
Unload frmShipping
m_strOldBrand = ""
and move the End Sub to a new line.
.Selection.TypeText Text:="Class
Average" & vbTab & vbTab & _
vbTab & vbTab & m_objCourse.ClassAverage
would not work until she changed it to
.Selection.TypeText Text:="Class Average"
& vbTab & vbTab & _
vbTab & vbTab & "Str(m_objCourse.ClassAverage)"
Set Word.Global = Nothing
If Len(App.Path) = "3" Then
Page 634. Quotation marks have been left off the PathName and FileName entires--and the slashes shown should be backslashes. Therefore, this
regsvr32 c:/vbfiles/practice/activexdll/academicssupport.dll /u
should be
regsvr32 "c:\vbfiles\practice\activexdll\academicssupport.dll" /u
Page 635. Screenshot is wrong---per the above.
Page 636. Quotation marks have been left off the PathName and FileName entires--and the slashes shown should be backslashes--as above.
Page 637. Screenshot is wrong---per the above.
Page 638. Quotation marks have been left off the PathName and FileName entires--and the slashes shown should be backslashes--as above.
Therefore, this
regsvr32 c:/vbfiles/practice/activexdll/academicssupport.exe /u
should be
regsvr32 "c:\vbfiles\practice\activexdll\academicssupport.exe" /u