6 |
The LA Fox Developer Newsletter
|
March 1999
|
In Visual FoxPro, the DELETE command does not delete a record physically; rather, it only marks the record for deletion. Using the RECALL command unmarks the deleted record. In order to physically delete a record from a table in Visual FoxPro, use the PACK command. Using PACK requires the table to be opened exclusively. In a multi-user environment, it may be difficult to obtain exclusive use of the file for packing. To work around this problem, you can recycle deleted records by using the technique illustrated below.
This article assumes you have an existing database and certain fields have default values in the table.
The following code snippet does the following:
Looks for a deleted record.
Retrieves the default values from the table in the database.
Re-uses the first deleted record found.
If no deleted records are found, a new record is appended
LOCAL IcDeleted, dExpr, ncount, a_field(1)
IcDeleted
=
set(”DELETED”)
SET
DELETED OFF
Looks for deleted record in the table
LOCATE FOR DELETED()
IF FOUNDO
BLANK
FOR nCount
=
I
to AFIELDS(a_field)
dExpr
=
BGetProp(CursorGetProp(”SourceName”)+;
“.“
+
a_field[nCount,
1],
“Field”,; “DefaultValue”)
IF not Empty(dExpr)
REPLACE (a_field(nCount,
1])
WITH;
APPEND BLANK
ENDIF
SET DELETED &lcDeleted
In order to retrieve default values from the database, the database needs to be open at all times. If the database is not open, an error occurs.
recover unused space in memo files, you must issue a PACK
MEMO command (which requires that the table be opened
EXCLUSIVEly).
[Ed. Note: MS Knowledge Base articles may be reprinted freely. If you have a favorite or interesting one, forward it along to me at
brlee@mesllc.com.]
|
Out and About
(Con’t from page 3)
membership year when everyone that hasn’t paid their membership fees will stop receiving the newletter. So if you get a call from one of your fellow members, inquiring about the newsletter, tell them that all they need to do is to pay their dues and everything will be alright. <g> You can remind them that Standard membership is
$48
and Premium membership is $120. Standard membership gets you everything it did in the past. Premium membership allows you to get the newsletter in advance (electronically), a ZIP file of all the past newsletter articles in .DOC format (almost 5 year’s worth. ..as long as I’ve been the editor). This month also marks the inception of
“We get letters” Dept...
Hello. My name is Glenn Mason, and I’d like to share a unique opportunity for you to try a new, exciting product for Visual FoxPro and FPW 2.x. POWERHELP is an automated Help writer for FoxPro that creates context-sensitive, on-line Help systems and printed User Manuals for all of your FoxPro apps in minutes. PowerHelp can create Windows 3.x Wlnhelp, Windows 95/98/NT Winhelp, NEW HTML Help and printed manuals in Word format. To learn more check out www.micromason.com. Currently I am trying to forge marketing strategies that broaden exposure to our new product. In light of this, we are currently offering a 25% discount to all FoxPro User Group officers and $25 discounts to ALL members of your FoxPro user groups. We only ask that you display our PowerHelp User Group/Partnership banner on your web sites. Please feel free to contact me at any time to order PowerHeip or sign up for this special offer that will benefit all of your FUG members. Thank you!
In the Letterman tradition:
Reason #5: MS Alpha-testers were too hung-over from the “We Made Visual Studio 6!” party to notice it.
Reason #4: A new Fox Team coder is an ex-Ashton/Tate employee on a suicide mission.
Reason #3: A lousy attempt at what would have been a great Easter Egg.
Reason #2: Secret MS memo reveals that VFP has to be stopped!
Reason
#1:
Because VFP developers needed *something* to moan about in the new release!
John S. Koziol
MCP
-
Visual FoxPro
|
6 |