DOCUMENT:Q228833 01-JUL-1999 [mspress] TITLE :Desktop Applications for Microsoft Visual Basic 6.0 Training Kit PRODUCT :Microsoft Press PROD/VER: OPER/SYS: KEYWORDS:kbdocfix kbdocerr ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Desktop Applications for Microsoft Visual Basic 6.0 Training Kit ------------------------------------------------------------------------------- SUMMARY ======= This article contains comments, corrections, and information about known errors relating to the Microsoft Press book "Desktop Applications for Microsoft Visual Basic 6.0 Training Kit", ISBN 0-7356-0620-X. The following topics are covered: - Page 44: Text Correction - Page 60: Step 5: Add Code To cmdClear_Click Event - Page 75: mnuOptions_Click Should Be mnuOptionsToolbar_Click - Page 76: Figure 2.20 Should Show A Value In Index - Page 114: In Step 11 Change cmdOk to cmdHelp - Page 123: Correction To Code - Page 223: Correct Code After First Paragraph - Page 250: Dim Statement Should Match Set Statement - Page 257-258: Corrections To Sample Code - Page 259: Code Changes In Step 7 - Page 278: mnuCustSearch_Click Should be mnuGuestSearch_Click - Pages 304-305: Code Changes Needed For Sample To Work - Page 363: Chapter 10, Exercise 2 Is Missing Two Lines Of Code - CD-ROM: Chapter 9, Self-Check, Error In Question 6 MORE INFORMATION ================ Page 44: Text Correction ------------------------ On page 44, in the first sentence, change the word events to methods. Change: "Figure 2.3 illustrates the actions of the four form events:" To: "Figure 2.3 illustrates the actions of the four form methods:" Page 60: Step 5: Add Code to cmdClear_Click Event ------------------------------------------------- On page 60, step 5 should read: "Add the following code to the cmdClear_Click event:" Page 75: mnuOptions_Click Should Be mnuOptionsToolbar_Click ----------------------------------------------------------- On page 75, under "Displaying a Check Mark on a Menu Item", mnuOptions_Click should be mnuOptionsToolbar_Click. Change: Private Sub mnuOptions_Click () To: Private Sub mnuOptionsToolbar_Click () Page 76: Figure 2.20 Should Show a Value in Index ------------------------------------------------- On page 76, Figure 2.20 should show a value in the box labeled index, as the paragraph above it indicates that each item must have a unique index property. To properly illustrate menu control arrays this figure should show a menu item which has an index value. Page 114: In Step 11 Change cmdOk to cmdHelp -------------------------------------------- On page 114, in step 11 set the CausesValidation property of the cmdHelp control to False. This will cause the frmAbout to load when the Help button is clicked in step 18. Change: 11. In the Properties window, set the CausesValidation property of the cmdOk control to False. To: 11. In the Properties window, set the CausesValidation property of the cmdHelp control to False. Page 123: Correction To Code ---------------------------- The sample code does not produce the desired results. One of the purposes of the code is to make sure payment type had been selected (i.e. one of the option buttons had been selected), and that if a payment type is not selected a message appears stating "Payment type is required". In order to produce the desired results change the ElseIf statement for the OptionButton as follows: ElseIf TypeOf ctl Is OptionButton Then If grpPmtType(0).Value = False And grpPmtType(1).Value = False And grpPmtType(2).Value = False Then MsgBox "Payment type is required." Exit Sub End If Page 223: Correct Code After First Paragraph -------------------------------------------- On page 223, change the two lines of code after the first paragraph to match the practice exercise that starts on this page. Code should read: Set txt1.DataSource = Adodc1 txt1.DataField = CompanyName Page 250: Dim Statement Should Match Set Statement -------------------------------------------------- On page 250, in the code section for cmdConnect_Click, step 5, the variable in the Dim statement should match the variable in the Set statement. Change: Dim CN As Connection To: Dim cnData As Connection Page 257-258: Corrections To Sample Code ---------------------------------------- The code on page 257-258 will create run-time errors due to inconsistencies in the variables used. The following modifications will allow you to run the code using the Northwind sample database. Dim cnNorthwind As Connection Dim comSalesByYear As Command Dim rsSales As Recordset Dim prmBeginningDate As Parameter Dim prmEndingDate As Parameter Set cnNorthwind = New Connection Set comSalesByYear = New Command cnNorthwind.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;" & _ "Data Source = C:\Program Files\Microsoft Visual Studio\VB98\nwind.mdb" cnNorthwind.Open comSalesByYear.CommandType = adCmdUnknown comSalesByYear.CommandText = "[Sales by Year]" Set prmBeginningDate = comSalesByYear.CreateParameter("BeginningDate", adDate, adParamInput) comSalesByYear.Parameters.Append prmBeginningDate Set prmEndingDate = comSalesByYear.CreateParameter("EndingDate", adDate, adParamInput) comSalesByYear.Parameters.Append prmEndingDate prmBeginningDate.Value = "1/1/95" prmEndingDate.Value = "12/1/95" comSalesByYear.ActiveConnection = cnNorthwind Set rsSales = comSalesByYear.Execute Page 259: Code Changes In Step 7 -------------------------------- On page 259, the code written in step 7 will not run. There are errors in the ConnectionString. It should be written as follows: cnNorthwind.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;" & _ "Data Source = C:\Program Files\Microsoft Visual Studio\VB98\nwind.mdb" cnNorthwind.Open On the same page, in step 5, you declare two module-level variables. In step 7 the two variable are declared locally. It is not necessary to declare these variables in both places. Page 278: mnuCustSearch_Click Should be mnuGuestSearch_Click ------------------------------------------------------------ On page 278, steps 1 and 2 refer to mnuCustSearch_Click event. These steps should refer to mnuGuestSearch_Click event. Instructions for creating the menu structure, on page 88, indicate that this menu item was named mnuGuestSearch. Also in step 2, the code does not bind the fields it simply places information from the record into the text fields on the form. Change the first sentence in step 2 to read: "Next, write the code necessary to place fields from the record into the text fields on frmReservation." Pages 304-305: Code Changes Needed For Sample To Work ----------------------------------------------------- On pages 304 and 305, change the sample code as follows. On page 304, in step 7, declare both EnumChildWindows and GetWindowText as Public. On page 305, change the callback function from: Public Function EnumCallBack( ) To: Public Function EnumCallBack(ByVal hWndChild As Long, ByVal lParam As Long) As Boolean Page 363: Chapter 10, Exercise 2 Is Missing Two Lines Of Code ------------------------------------------------------------- On page 363, two lines of code are missing. Add the following code to the end of the Form_Load event procedure for frmReservations, Step 1: txtRate.Datafield = "Rate" FillControls CD-ROM: Chapter 9, Self-Check, Error In Question 6 -------------------------------------------------- There is a typo in the Self-check test on the CD-ROM, in Chapter 9, question 6. The question reads as follows: The following statements are used to call the SquareIt procedure: Sum = 4 SquareIt Sum And the SquareIt procedure looks like this: Sub SquareIt(num) num = num * num End Sub After the procedure call, what is the value of the Sum variable? A. 4. B. 8. C. 16. D. 0. This test gives A as the answer and refers to parenthesis around the argument Sum. There are no parenthesis around the argument sum. Either the parenthesis should be added or the correct answer should be changed. Microsoft Press is committed to providing informative and accurate books. All comments and corrections listed above are ready for inclusion in future printings of this book. If you have a later printing of this book, it may already contain most or all of the above corrections. Additional query words: 0-7356-0620-X ms_press TKBOOK VB ====================================================================== Keywords : kbdocfix kbdocerr Issue type : kbinfo ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1999.