Assignment 4 Tips
8.2, p. 505: Make sure you have some good code to start from.
Don't try to do this one using
an SQL query ("SELECT * FROM...") like the example given in the chapter.
It's just too complicated that way. Instead, as a starting point, I would highly
recommend borrowing some code from Access Lesson 7 (see page 445)--
that problem is quite similar in structure. Notice that it looks up a value and then
modifies a value, just like the problem in 8.2. (You will
still need to use a Select/Case
structure to implement the logic.)
9.1, p. 535: This one has several things
that can go wrong.
- It's connected to an .mdb
database, and you may see a connection error. If so, click "Database..." and locate
the MthSales.mdb file.
- Delayed updating.
Notice that the SQL query is not actually run until the
qtbSales.Refresh statement is run, so make sure your code
to change values ("J" to "Jefferson") comes after the Refresh. Code
order is important here!
9.9, p. 539: There are several errors in
these two functions. These are the ones I went over in
lab last week. Notice that some of the errors are in
one function but not the other--this might help you
locate some of the problems. Big hint: Worksheets <> Worksheet.
10.7, p. 626: There's more than one bug.
If you fix the more obvious one first, you'll likely create an infinite loop.
As the problem advises, remember Ctrl-Break is a lot
easier than restarting your computer. Look back at examples in the chapter
if you're having trouble figuring out what's missing from the code.
Assignment 5 Tips
Exercise 13.3, p. 858: Although it seems logical to approach this with an SQL
query, it's easiest to just use the properties of the list control (lstID or whatever you
named it). As the problem notes, the list has a property
Column(columnindex as Integer, rowIndex as Integer). You can use this to access any
of the values in the table, without actually referring to it.
Exercise 14.3, p. 882: If you get stuck
because you can't remember how to store a value in a
Microsoft Word form field, check out the following
fragment of code from
Tutorial 6, Exercise 6, which stores code in a
Word form field.
'assign code and quantity to form fields
docTaft.FormFields("code").Result = strCode
docTaft.FormFields("quantity").Result = intQuantity
Remember that you can index by number, e.g.
FormFields(1) which might be simpler than
figuring out all four field names.
Exercise 14.3, p. 911: Part of this program requires you to create a new
Excel worksheet instead of opening an existing one. Instead of using Open, then,
you can simply use:
' Create a new Excel workbook from outside Excel, using the
' Excel Application object.
'
' This code fragment assumes:
' appExcel is an object of type Excel.application
' wkbNew is an object of type Excel.Workbook
Set wkbNew = appExcel.worksheets.add