Special Edition Using Visual FoxPro 6


About the Authors

Menachem Bazian, CPA, is director of Client Services for LNW Consulting Services, LLC, a Business and Technology Consulting Firm based in New York City. Menachem has been a developer and consultant for 13 years. He is an internationally known expert on object-oriented analysis, design, and development and has lectured extensively on the subject. He also possesses expertise in business process analysis and redesign, which he uses regularly in the service of his clients. Menachem has spoken frequently at conferences, including the FoxPro and Visual FoxPro Developer's Conferences from 1990-1998, various regional FoxPro conferences across the U.S. and Canada, the Foundation for Accounting Education, The N.Y. State Society of CPAs' annual accounting and computer shows, and others. He has written for many magazines, including Databased Advisor (now e-Biz Advisor), FoxPro Advisor, New Accountant, and more.

Jim Booth is a Visual FoxPro developer and trainer. He has written articles for the major FoxPro journals and has spoken at conferences in North America and Europe. He has been the recipient of the Microsoft Most Valuable Professional Award every year since its inception in 1993. He is married and the father of three boys, and wishes he could program them as easily as Visual FoxPro. His house is also populated with two dogs, a cat, a fish, and a bird.

Jeb Long has 35 years experience in software design and engineering at some of the most prestigious technical organizations in the country. Since leaving Ashton-Tate Corporation in 1990, he has worked as an independent consultant and author, and has written technical documents, several books, and articles for technical journals. While at Ashton-Tate, he was the dBASE language architect and was responsible for the dBASE language components for all versions of dBASE III and IV, except for the initial version. During 14 years at the California Institute of Technology's Jet Propulsion Laboratory, he was responsible for software tasks in support of our nation's planetary exploration program. Among these tasks were programs to calculate interplanetary trajectories, to process telemetry from space vehicles, to simulate spacecraft propulsion subsystems, and to support spacecraft tests and operations. He was actively involved in the Mariner and Viking Missions to Mars. He and his wife Elizabeth, a technical writer who works closely with Jeb in writing all of his books, now live on a hill over-looking Los Angeles.

Vin Miller is a Senior Analyst at InvestLink Technologies, a New York City-based software development firm providing database, Internet, and telephony solutions for the defined contribution industry. He has programmed in FoxPro since 1990. He is the co-author of Family Planning and Population: A Compendium of International Statistics, as well as several scholarly articles on international demographics and research methods.

Ceil Silver has been in the computer industry since 1967, first as a COBOL and RPG programmer, and from there filling many corporate positions involving applications software development, systems software support, and software project management. She has been an independent consultant in the NYC metropolitan area since 1989, specializing in database applications and systems analysis for a variety of industries. Her current development tool of choice is Visual FoxPro. She is also founder of the Westchester FoxPro of PADD (Professional Association of Database Developers), in Westchester County, NY.

Robert A. Byers is a nationally recognized authority on database management systems for microcomputers. He is currently a partner in Balleisen-Byers, a developer of client/server database products for desktop computers. A former manager of the Mission Control and Computing Center at the Jet Propulsion Laboratory in Pasadena, California, Mr. Byers has held numerous positions of responsibility in the computer and communications industries over the past 32 years. He has served on several government advisory panels for Communications and Data Handling, including the select panel on Data Handling and Avionics for the Space Shuttle and NASA's Planetary Data Systems Working Group. He was actively involved with the development of dBASE, and often acted as a spokesman for Ashton-Tate prior to their purchase by Borland. He has served as an independent consultant on microcomputer software to several major corporations, and has developed vertical market applications software for the medical and retail business communities. The author of numerous technical papers and several best-selling computer books, he also holds a U.S. patent on Distributed Signal Processing. His Everyman's Database Primer became a standard and was translated into several languages. An engineer by training, he has a B.S.E.E. from California State Polytechnic University at San Luis Obispo, M.S.E.E. from Georgia Institute of Technology, and has done additional post-graduate work in Communications Theory at U.S.C. He has been employed by Ampex Corporation, Bell and Howell, the Georgia Tech Research Institute, and JPL.

Acknowledgments

Writing a book is a bear of an undertaking, not only for the author but for those around him. Mere words cannot do justice to the effect these people have had on me, either through technical assistance or moral support. Still, words are all I have.

First of all, to the incredibly talented team of people at my new firm, Levine Mandelbaum Neider Wohl, LLP. To the partners, Mark Levine, Jay Neider, and Lester Wohl; to Glenn Davis, Michael Giller, Tery Gingold, Valerie Jaraique, Carol Lechner, Katherine McCoy, Renee Neil, and Joe Vecchio. Thank you for welcoming me into your firm and showing trust in me. I enjoy working with you all.

To David Lazar, Robert Green, Jim Saunders, Susan Graham, Randy Brown, Calvin Hcia, and so many people on the Microsoft Fox team. You guys created another super winner here. Thanks.

To my incredible editors at Que. To Angela Kozlowski and her merry crew, thanks for being so understanding and for working with me.

To David Blumenthal, Yair Alan Griver, Lior Hod and everyone at Flash Creative Management. Thank you for 6 1/2 fascinating years. Oh, and to Chushie (What's the count now, Alan?).

To the people in the Fox community I have had the pleasure of knowing and working with: Pat Adams, Steven Black, Jim Booth, Chaim Caron, Barr y Cunningham, Sue Cunningham, Doug Dodge, Mike Feltman, Tamar Granor, Doug Hennig, Nancy Jacobsen, Jim Korenthal, John Koziol, Barr y Lee, Ken Levy, Patrick Logan, Valid Matisons, Paul Maskens, Michael Meer, Andy Neil, John Petersen, Rod Paddock, Alan Schwartz, Ceil Silver, Drew Speedie, Toni Taylor-Feltman, and many more. There are so many of you that I cannot mention you all, but you all have had a special place in helping make my work possible and fun.

Once again to my friend and mentor, Martin Star. I can never say thank you enough for all you have taught me. How'm I doing, Marty?

To Chaim Wasserman. For once words fail me. I have no idea what I could say that would be appropriate for all the times you have been there throughout the years. "Thank you" seems pitifully inadequate, but it's all I have.

To Mark and Meryl Berow and Marc and Judith Stoll. Together we have shared much happiness and adversity. I couldn't imagine having better friends. Thanks.

To Mordecai and Charlotte Glicksman, and their twins, Chana Tova and Elisheva. Thanks for sticking with me over the years. We've come a long way together and I look forward to sharing with you for a long time to come.

I leave for last the people who mean the most to me. To my father, Murray Bazian, and my brothers, Ben and Sol. Thanks for all your advice and help. Even if I don't say it enough, I appreciate it.

To my beloved wife, Anna: Once again you had to put up with a book and you did it with remarkable aplomb. I know that this is never easy on you and I appreciate your support.

To my incredible twins, Barr y and Sam. Somewhere along the line, when God was handing out blessings, he looked at your mother and me and decided that we should have you. I don't know what I did to earn it, but I thank him every day for both of you. Over the years I have laughed with you and cried with you. But, above all, I have watched with neverending awe and amazement, as you have grown into two strapping young men from the little infants I worried over in the neonatal intensive care unit. Your wit, charm, and intelligence are a constant source of joy to me. Now, if only I can get you guys to do your homework and go to bed on time, life would be almost perfect :).

Finally, to Isaac. You are much too young to read this now. Still, in a few years when you have grown a little and learned to read, perhaps these words will have some meaning. You entered our lives and have turned life into a neverending series of new experiences. Neither your mother nor I ever really imagined that a baby could change our lives quite as much as you did but I can tell you that all of us, your big brothers included, bless the day you decided to join us. You have taught us a lot, believe it or not. I look forward to each and every day with you.

- Menachem Bazian
I would like to thank all of the people who frequent the electronic forums for Visual FoxPro. Their questions have motivated me to investigate aspects of Visual FoxPro that I may never have looked into on my own. Special thanks go to John Petersen for his insights and assistance. Additional thanks go to Menachem Bazian for his guidance and inspiration during the writing of this book.

- Jim Booth
Grateful acknowledgment is extended to all the people who made this book possible with their enthusiastic support and encouragement, including the MCP Editorial and Publishing staff, with special gratitude to Angela Kozlowski, Bryan Gambrel, Chris Haidri, and Dallas Releford. To Elizabeth Long-thanks for all your editorial assistance and encouragement in developing and preparing the chapters for this book.

- Jeb Long
My thanks go out to the members of the far-flung electronic FoxPro community who have made up my virtual office for the past ten years. The online associations, made primarily through CompuServe's FoxForums, have provided a major source of continuing education and professional feedback, leading to ongoing real-world friendships.

- Ceil Silver

Introduction

Welcome to Using Visual FoxPro 6, Special Edition! This book is your guide to the exciting world of working with the latest release of Microsoft's award-winning database product, Visual FoxPro.
Visual FoxPro has a long and illustrious history as the most flexible and powerful database application on the market. Starting from its origination as Fox Software's FoxBASE product, "Fox" (as it's known among its international community of developers) has always been known for its reliability, speed, and effectiveness as a programmer's database product.
This book is designed to take you into the world of Visual FoxPro. Whether you're a beginner, intermediate, or advanced user, this book has what you need to strengthen and improve your development efforts.

What is Visual FoxPro?

Don't laugh, it's not that silly a question. FoxPro has changed radically over the years. It's not a bad idea to take a little time and review how it has gotten where it is. This will give you additional perspective on the product you're now reading about.

The History

Back in the "old days" (the late 1980s), FoxBASE was intended to be a dBASE clone. If dBASE did it, FoxBASE would do it better and faster (or at least that was the idea). Although FoxBASE had some revolutionary features in it, it was not really intended to be revolutionary; it was designed to be better and faster and, above all, compatible with dBASE III.

FoxPro 1.0 was the first departure from the compatibility dance with dBASE. It began to introduce some new concepts in GUI design and ways of developing software that put it ahead of the by-then floundering dBASE.

FoxPro really came into its own with version 2.0. When FoxPro 2.0 was introduced, several key technologies were included that revolutionized the PC database development market:

I could go on and on, but you get the idea. FoxPro 2.0 was the real advent of the exciting capabilities you have today in Visual FoxPro. GUI design services, SQL, and lightning-fast data access were its hallmarks.

Windows support was added in FoxPro 2.5. Support for Dynamic Data Exchange came along for the ride, but as anyone who was around in those days will testify, the Windows version of 2.5 had the look and feel of a DOS app made to look "windowsy."

The next major revolution had to wait until the release of Visual FoxPro 3.0. Once again, FoxPro, now in the hands of Microsoft (which bought out Fox Software during the development of FoxPro for Windows), revolutionized the database development world. Version 3.0 added a host of long-awaited features and took the PC database development world by storm. Here are just a few of the features added in 3.0:

Version 5.0 was an upgrade of 3.0 and contained a lot of bug fixes and some interesting new features. The capability to use and create COM servers (a topic covered in-depth in Part V of this book) was introduced. Some additional commands and functions were added and you saw the beginning of support for publishing Visual FoxPro on the Internet. But 5.0 was not a radical departure from 3.0.

Getting to Know 6

Version 6 is not a radical change either, but some of the changes to the product are momentous. Access and Assign methods (covered in Part IV of this book) introduce a new dimension to controlling data placed into your objects. The new Component Gallery and Foundation Classes ease your transition into creating object-oriented applications. Better COM support is probably one of the more significant changes, enabling easier and better creation and implementation of COM servers. Finally, as the clock continues to tick toward the end of the millennium, improved Year 2000 support is a welcome addition, as well.

The Bottom Line

Okay, here's the bottom line. Visual FoxPro is the premier development product for creating mission-critical, enterprisewide, object-oriented, client/server applications designed for local or global deployment.

But Isnít Visual FoxPro Dead?

Frankly, I'm getting really tired of hearing that question. I have been hearing it for years now. Visual FoxPro is not dead, it is very much alive and thriving. Despite what you might hear from some rumormongers, Visual FoxPro is the best product, even in the Microsoft suite, for developing database applications. Let's face it: Visual FoxPro was designed, from its inception, to handle data. It is fast, powerful, and flexible.

This doesn't mean that Visual FoxPro's role in application development is not ever going to change. Some change is already in motion. The world is beginning to move away from monolithic, single-tiered applications to multi-tiered (n-tiered) applications, as explained in the COM section of this book. Visual FoxPro is a natural for the middle (business rules) tier in a multi-tiered application.

As part of the Visual Studio product suite, Visual FoxPro is now part of a technology team for creating enterprise-wide solutions. The days of an application written only in Visual FoxPro (or Visual Basic for that matter) are numbered. As browsers such as Internet Explorer gain more intelligence, GUI front ends are going to be ported to browsers for a host of reasons. The back-end datasource will be whatever it is (Visual FoxPro, SQL Server, Oracle, or whatever). Sitting right in the middle will be our old friend, Visual FoxPro.

So, here's the deal. If you want to develop a premier application and maintain your investment for the future, Visual FoxPro is a great way to go.

What If I Have Old FoxPro Applications?

Your old applications should run unmodified under Visual FoxPro. Of course, you'll need to test this out, but that's the party line. In terms of upgrading an older FoxPro application to Visual FoxPro, you have three options:

The downside to totally rewriting, of course, is that it's the costliest approach. A great deal of time is spent doing tasks that have already been done.

Who Should Read This Book?

So, now that you know where Visual FoxPro fits in with the development world, it's time to examine what you can do to bring yourself quickly up the learning curve, and what you can do about upgrading your existing systems to Visual FoxPro (if you have a mind to).

Will Using Visual FoxPro 6, Special Edition help you in this process? The answer is a resounding yes! (Did you expect any other answer from the introduction to the book?) Seriously, Using Visual FoxPro 6, Special Edition is the book for you if you are:

The book is also chock-full of practical routines and tips and tricks on using Visual FoxPro to its fullest as a development tool for mission-critical, object-oriented, client/server applications.

Are you ready to journey into the exciting world of Visual FoxPro? Then sit back, strap yourself in, and read on.

Conventions Used in This Book

This book uses various stylistic and typographic conventions to make it easier to use.

NOTE
When you see a note in this book, it indicates additional information that may help you avoid problems or that should be considered in using the described features.

TIP
Tip paragraphs suggest easier or alternative methods of executing a procedure. Tips can help you see that little extra concept or idea that can make your life so much easier.

CAUTION
Cautions warn you of hazardous procedures (for example, activities that delete files).


Tell Us What You Think!

As the reader of this book, you are our most important critic and commentator. We value your opinion and want to know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way.

As the Executive Editor for the Database team at Macmillan Computer Publishing, I welcome your comments. You can fax, email, or write me directly to let me know what you did or didn't like about this book-as well as what we can do to make our books stronger.

Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able to reply to every message.

When you write, please be sure to include this book's title and author as well as your name and phone or fax number. I will carefully review your comments and share them with the author and editors who worked on the book.

Fax:317-817-7070
Email:cs_db@mcp.com
Mail:Bryan Gambrel
Executive Editor
Macmillan Computer Publishing
201 West 103rd Street
Indianapolis, IN 46290 USA


© Copyright, Macmillan Computer Publishing. All rights reserved.