Errata

Microsoft Access 2010 VBA Programming Inside Out

Errata for Microsoft Access 2010 VBA Programming Inside Out

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page xxiv
3

I tried to use the link for the companion and could not locate it, it is NOT on the microsoft website anywhere. Is there another place that it could be? Am I using the wrong "equipment" (i.e. laptop)? Should I be using something else, like my tablet? I just thought I would use what I'm doing the work on...
Any advice or help would be appreciated

Anonymous  Jan 21, 2014 
Printed, PDF Page 140
Code snippet

The code snippet shows the same constant being used regardless of whether imperial or metric system is determined:

If modInternational_IsUSSystem() Then
' inches
lngRight = 2 * lngTwipsPerCm
lngDown = 2 * lngTwipsPerCm
lngWidth = 12 * lngTwipsPerCm
lngHeight = 6 * lngTwipsPerCm
Else
' cm
lngRight = 5 * lngTwipsPerCm
lngDown = 5 * lngTwipsPerCm
lngWidth = 30 * lngTwipsPerCm
lngHeight = 15 * lngTwipsPerCm
End If

If "cm" code should use the previously declared const "lngTwipsPerInch".

Tony

Anthony Croft  Oct 23, 2013 
Printed, PDF Page 150
3rd paragraph

Last sentence refers to:

Application.ScreenObject,

but there is no such object (looks like a typo as code above correctly refers to Screen object).

Tony

Anthony Croft  Oct 25, 2013 
Printed, PDF Page 169
3rd paragraph

The text states that after a stock item has been updated within a transaction, a row-level lock is in place (...until the transaction completes). However, if you try halting the code after a stock level for a particular item has been updated (but not yet committed) you will find that the whole table (tblProducts) is locked, not just the row,

Anthony Croft  Oct 30, 2013 
Printed, PDF Page 173
Code snippet

Table tblErrorLog does not exist in database SQLServerExamples so the Error Logging part of the code will fail. The simple remedy however is to import it from VBAFeaturesExamples from Chapter 3.

Anthony Croft  Nov 03, 2013 
Printed, PDF Page 173
Under Database Object heading

Test refers to Workspace(0), which should be Workspaces(0).

Anthony Croft  Nov 03, 2013 
Printed, PDF Page 174
2nd para

Text refers to

Workspace(0).Database

collection, however this should of course be :

Workspaces(0).Databases

collection.

Anthony Croft  Nov 03, 2013 
PDF, ePub Page 174
Last para

This is not an error in the text, but this para refers to an example database called DocDAO.accdb, which rather handily provides some code for interrogating and documenting the objects contained in any other database(s).

There is a minor error in the Sub called:

modAnalyze_Documents

in that the counter used in the sub for establishing the number of documents, namely lngItems, is incorrectly set as

lngItems = dbTarget.QueryDefs.Count

As the sub iterates over container objects then the counter should refer to the container not "querydefs", i.e.:

dbTarget.Containers(ContainerName).documents.Count

Similarly, in the sub modAnalyze_ListTablesFields, the counter is set as:

lngItems = dbTarget.TableDefs.Count

and subsequently displays a message to the user using this variable:

modBars_Open lngItems, "Processing " & lngItems & " fields in each table ...please wait"

Either the message needs to refer to tables being processed or the number of fields in the current table. If the latter then obviously the message needs to come lower down within the For Loop that iterates over the fields...such as:

modBars_Open lngSubItems, "Processing " & lngSubItems & " fields in table: " & td.name & "...please wait"

where lngSubItems refers to:

lngSubItems = td.Fields.Count

Tony

Anthony Croft  Nov 04, 2013 
Printed, PDF Page 174
DocDAO reference

Not an error as such but the code in form module frmDataBase within DocDAO could be more efficient in some places, take cmdPickADatabase_Click. The code contains a Loop to go through the file path selected in frmFileSelection to retrieve just he database name excluding the extension.

The loop iterates over the path using inStr function to find the last instance of a backslash. However a loop is not needed if the instrRev function was used (automatically finds the last instance of a "\").

Also the same code will not work where the database is stored under root (c:\) as only one backslash will be present and spos will stay at zero.

Also, in the Form_Open event of frmFileSelection, the If..then..Else is incorrectly specified as:

If UCase(Right(CurrentDb.Name, 6)) = ".ACCDB" Or UCase(Right(CurrentDb.Name, 6)) = ".ACCDE" Then
Me.lstExtensions.RowSource = """*.mdb|*.accdb"";""*.mdb"";""*.accdb"""
Me.lstExtensions = Me.lstExtensions.ItemData(0)
Else
Me.lstExtensions.RowSource = """*.mdb|*.accdb"";""*.mdb"";""*.accdb"""
Me.lstExtensions = Me.lstExtensions.ItemData(0)
End If

Obviously both branches are the same so it has no purpose. (I am sure we all know what was meant, but just pointing out).

Tony

Anthony Croft  Nov 14, 2013 
Printed, PDF Page 176
1st para

The text states:

"After running this code, close and then re-open the database. You will see the newly created objects in the Navigation window as a result of having executed the RefreshDatabaseWindow
command (see Figure 5-6). Both of the new objects will be available when using CurrentDB, but not with DBEngine until you execute DBEngine(0)(0).QueryDefs.Refresh."

However, both of the new objects ARE available to both CurrentDB and DBEngine when the database is reopened. You will need DBEngine(0)(0).QueryDefs.Refresh if not re-opening the db. If the first line of the paragraph is removed this para makes sense. Re-opening the db will obviously make all objects available again to both CurrentDB and DBEngine without RefreshDatabaseWindow being run at any stage.

I know what you mean Andy but this para. could perhaps of been better written as taken literally it leaves you scratching your head somewhat as to what it is meant to prove.

Tony


Anthony Croft  Nov 20, 2013 
Printed, PDF Page 182
Code Snippet

Code needs the following line to add a size attribute for text fields as this is supplied in tblFieldList:
:
If rst!NewDataType = dbText Then fld.Size = Nz(rst!NewFieldSize, 255)

Tony

Anthony Croft  Nov 25, 2013 
Printed, PDF Page 183
Inside Out

The Inside Out refers to using the Decimal datatype when using DAO. However the Decimal datatype is not available in the Access query interface or DAO (despite it being listed as a constant of DAO.DataTypeEnum). Consequently Decimal Places is not a member of the field object.

I do not believe Field2 provides any new functionality around the creation of decimals either.

Decimal Places can be set for Fields in table design to display a certain number of decimal places (but the format property must be set also) in datasheet view. You can also set format/decimal places separately for a bound control on a form. Neither affect the way the number is actually stored.

NB. The VBA Help suggests that "..A bound control you create on a form or report inherits the DecimalPlaces property set in the field in the underlying table or query..." On testing I found this not to be true.

Tony

Anthony Croft  Nov 27, 2013 
Printed, PDF Page 184
General comment

This isn't an error with the book, but the Load event for frmTableDefProperties, should have an additional line (highlighted) to avoid displaying system temporary table names in the form's combo:

For Each tdef In db.TableDefs
If Left(tdef.Name, 4) <> "MSys" And _
Left(tdef.Name, 4) <> "USys" And _
Left(tdef.Name, 4) <> "~tmp" Then ' ADDED LINE
If strcbo <> "" Then strcbo = strcbo & ";"
strcbo = strcbo & tdef.Name
End If
Next

Tony

acroft46160  Nov 27, 2013