home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
vb_code1
/
fox_adr
/
readme.txt
< prev
Wrap
Text File
|
1993-08-26
|
4KB
|
78 lines
This is a revised version of ADR.ZIP - a simple address book
application written in VB 3.0. It is intended to show one or two
techniques for accessing and maintaining FoxPro tables with Visual
Basic.
To run it you need VB 3.0 professional edition. There is an .EXE
included as well, which you can run if you have the VBRUN300.DLL and
XBS110.DLL files on your system.
***PLEASE NOTE*** It will only run if the files are placed in a
directory called ADR on drive C. If you change this directory, you
will need to amend the path in the MAIN procedure, and several times
in the PACK procedure as well.
This version is a little more elaborate than the previous one. It also
differs in that the tables are in FoxPro format rather than dBase.
I hope its use is self-explanatory. The "Action needed" checkbox is
intended as a way of marking the addresses of people where you need to
take some action, such as replying to a letter. You can set the
application just to show people who have action outstanding with the
"Show outstanding action only" checkbox.
This leads to some interesting interactions, as the application needs
to cope with possibilities like the "Action" checkbox being unchecked
when the "filter" is active and there are no more records with
outstanding action.
If you downlaoded ADR.ZIP you will notice a major change of approach.
The original had the fields on the form updated directly from a VB
table object. This new one uses a dynaset instead. The penalty is that
one can no longer use "Seek". The advantage is that you can easily
restrict the visible records to a subset, which is not possible with
table objects (the equivalent of a SET FILTER... in xbase).
Dynasets have no index property. Therefore, the order is achieved by
including "Order by" in the SQL statement which creates the dynaset.
One consequence of this is that the dynaset needs to be recreated
whenever a record is added. Otherwise, the new record goes onto the
end of the dynaset, out of the correct order.
VB 3.0 records have no record number - the RECNO() that is so useful
in FoxPro is absent. Therefore, this application illustrates how a
counter field can be maintained in an xbase table. When a record is
added, a unique number is found by Using the MAX function in a SQL
query to find the highest existing number, and adding one.
This number is valuable for recording and restoring the current
record. It's also used in a simple implementation of a read-only
browse. The "List" button brings up a scrolling grid containing
records. Each row actually includes the record number, although this
is not visible. Therefore, when the user clicks on a row with the
mouse, and exits the "browse" with OK, the application can easily look
up the correct record and display it on the form.
The main headache is that updating a grid is so slow in VB! Therefore,
it is not refreshed automatically (when a filter is set, or a record
is deleted or added). You need to choose the "Refresh" button to
refresh the list when necessary.
Finally, I've improved the "Pack" function by using the SQL INSERT
function. Still very slow - but faster than it was.
I hope some of you find one or two tips from this app. Equally, I'd be
glad to hear of other, better ways of solving some of the problems
which come up even in a simple app. like this. Please post any
suggestions in the forum, or mail me on 100023,3154.
This app. is not thoroughly tested - be cautious if you put it to
serious use!
All the best,.
Tim Anderson
26 August 1993