Help  |   Contact Us  |   About Us  |   News and Events
Books, conferences, and other information about... Moving to Linux Switching to OOo Building Linux Apps Using Visual FoxPro
Buy      Download      Your Account      Catalog      Support      Conferences      Resources      Fun

Hacker's Guide to Visual FoxPro 6.0

If you have a question about the technical contents of this book, please contact the author(s). Their email address(es) can usually be found in their bios in the About the Author section at the front of the book or on the author's bio page (click on the author's name on the book's main page.

Page 14: Date Math

In the last sentence of the third paragraph, the phrase "or from character to date (DTOC())" should read "or from date to character (CTOD())".

Page 18: Hip Hip Array!

The first sentence under the code should read "Visual FoxPro returns 8!"

Page 24: Operator, Operator, Give Me Number Nine

Add "#" for "not equals" to the list of comparison operators.


In the third Usage diagram, for ADD PRIMARY, the optional FOR clause must be placed before the TAG clause, when it's used, as follows:

  ADD PRIMARY KEY uPrimaryKeyExpression
  [ FOR lPrimaryKeyFilter ] TAG PrimaryKeyTag

Page 210: AMembers()

In the Usage table, in the entry for nInfoType=1, add "Event" to the list of items that can occur in the second column.

Page 292: ChrTran(), StrTran(), Stuff(), Sys(15), Sys(20)

In the Usage section, the second and third parameters for SYS(15) are reversed. The correct syntax is: cRetVal = SYS( 15, cTransTable, cSource )

Page 476: Format (pg. 476)

The last line of the example should read: ThisForm.txtSSN.InputMask = "999-99-9999"

Page 513: GoMonth()

The DiffDate() UDF example had problems handling the leap day and would occasionally give incorrect answers if one of the dates was February 20th. Here's a corrected version of DiffDate():

FUNCTION DiffDate(tdDate1, tdDate2)
LOCAL ldNewDate, lnDifference, lnYears
* Use GOMONTH() function to bring dates into the same year, then
* subtract the difference
lnYears = YEAR(tdDate2) - YEAR(tdDate1)
ldNewDate = GOMONTH(tdDate1, lnYears * 12)
lnDifference = tdDate2 - ldNewDate
* If they're still too far apart, bump ldNewDate a year + / -
IF ABS(lnDifference) > 182
  lnYears = lnYears + 1*SIGN(lnDifference)
  ldNewDate = GOMONTH(tdDate1, lnYears * 12)
  lnDifference = tdDate2 - ldNewDate
RETURN ABS(lnDifference)

The final example, which calculates the last day of the current month, doesn't work if you're currently on the last day of a month followed by a shorter month. Here's a corrected version:

ldLastDay = GOMONTH(DATE() - DAY(DATE()) + 1, 1) 1

Page 529: Highlight, HighlightRow 

The FoxPro Advisor article referenced in this section actually appeared in November '98, not October '98.

Page 547: InputMask 

The last line of the example should read: ThisForm.txtSSN.InputMask = "999-99-9999"

Page 603: MessageBox(), FoxTool's MsgBox() 

In the table of parameters, the values for the "Yes, No" and "Abort, Retry, Ignore" button sets are reversed. For "Yes, No" buttons, add 4; for "Abort, Retry, Ignore" buttons, add 2.

Page 653: OptionButton, OptionGroup 

In the parenthetical sentence at the end of the first paragraph, the groups of ages should be 0-12, 13-24, 25-49, 50-64, and 65 and above.

Page 674: PrintJob 

The entry for PrintJob was omitted from the printed book. It's reproduced here in its entirety:

PrintJob ... EndPrintJob, _PBPage, _PCopies, _PECode, _PEject, _PEPage, _PSCode, _PWait

This command pair and the whole slew of associated system variables are remnants of a printer control system that first appeared in FoxPro 1. In that DOS-dominated, application-centric, dot-matrix, tractor-feed world, it was a clever way to avoid providing printer drivers but still give you control over output. In a Windows world, most of this is totally irrelevant. Only one of these variables still does anything, and it doesn't do it very well. The table shows what these variables were originally intended to do. Except for _PCOPIES, they're all ignored in Visual FoxPro.

Variable Type Meaning
_PBPage Numeric The number of the first page to be printed.
_PCopies Numeric The number of copies to print.
_PECode Character Printer control codes to send after printing.
_PEject Character Determined whether ejects were sent before the report, after the report, both or neither.
_PEPage Numeric The number of the last page to be printed.
_PSCode Character Printer control codes to send before printing.
_PWait Logical Determined whether to wait for paper to be loaded before printing each page.

PRINTJOB ... ENDPRINTJOB is a wrapper that says everything inside is to be treated as one group. If _PCOPIES is greater than 1, PRINTJOB ... ENDPRINTJOB creates a de facto loop. Although _PCOPIES works, it's no better than simply wrapping your call to REPORT FORM in a FOR loop. It still generates the report multiple times and sends each to the printer independently. We suggest you forget these are even in the language. Saying this makes us very unhappy, since _PBPage and _PEPage used to let us print only part of a report, but they don't do it in VFP. Starting in VFP 5, the RANGE clause of REPORT FORM is the solution to that one.


See Also Report

Page 686: QueryUnload

In the paragraph after the example, the phrase that says "when a user closes your application by double-clicking in the main window" should read "when a user closes your application by closing the main window."

Page 841: StrictDateEntry

In the Usage section, "StrictDataEntry" should be "StrictDateEntry".

Page 887: Update-SQL

The example is incorrect as it fails to include the table name. It should be: 

UPDATE PhoneList SET AreaCode = cNewCode ;
  WHERE AreaCode = cOldCode ;
  AND LEFT(Phone,3) IN (SELECT Exchange FROM Exchanges)

CHM File Links

In the topic in the Hacker's .CHM file titled "Set TextMerge, Set("TextMerge"), \, \\, _PreText, _Text, Set TextMerge Delimiters, " the 'Text' link in the 'See Also' section at the bottom of the topic, should be linked to the 'TEXT ... ENDTEXT' topic, rather than the TEXT topic.

Where's the CD?

Late in the production process, we discovered that the extra text added for the 6.0 version of the book made it a real challenge to produce. We chose not to skimp on the production of the book, and instead, made all of the source code, as well as the HTML Help version of the book, available online, at Please check there to download the code. Make sure you have the book available, as you need to prove you have purchased the book in order to access the source code and HTML Help version.

What is the purpose of the book?

The Hacker's Guide to Visual FoxPro 6.0, casually referred to as HackFox6, is the single greatest reference book ever written for FoxPro. Bar none. Ever. We're proud of the work we have done, and the help we have received from throughout the FoxPro community, in making this book the best.

That said, HackFox6 is not a training manual. If you are new to Visual FoxPro, or you are looking for a tutorial, check the other books in the Essentials series ( HackFox6 is the comprehensive reference to every command, function, property, event and method in the language. If you have a question on how to use a particular command, or are running into a kink in getting a particular method to work, chances are that HackFox6 can answer your question.

When I try to order the book, my favorite (online) bookstore says the book is not available or that it may take weeks to get it. How can I order your book?

The world of merchandising books is far stranger than we would have ever anticipated. While many bookstores seem to be really challenged in ordering the book, it is available. For the fastest delivery, try The other online booksellers (we don't have to supply their links here, do we?) are among our biggest customers, and they, too, can deliver the book pretty quickly. Any bookstore can order the book directly from Hentzenwerke Publishing, or you can order it yourself.

Hacker's Guide is a registered trademark of Pinecliffe International, used with permission. Visual FoxPro is a trademark of Microsoft Corporation.