Create a Single Table Data Entry Form Sample
File: ...\Samples\Solution\Forms\Single.scx
This sample illustrates the simplest scenario for a single-user, single-table data entry form.
The ControlSource property of each of the text boxes and combo boxes on the form is set to a field in the Customer table.
An APPEND BLANK command is issued in the Click event of cmdNew.
APPEND BLANK
THISFORM.Refresh
The DELETE command is issued in the Click event of cmdDelete.
* cmdDelete.Click
#DEFINE MSGBOX_YES 6
#DEFINE C_MSGBOX1 36
#DEFINE C_DELETE_LOC "Are you sure you want to delete this record?"
IF MESSAGEBOX(C_DELETE_LOC,C_MSGBOX1) = MSGBOX_YES
DELETE
IF !EOF()
SKIP 1
ENDIF
IF EOF() AND !BOF()
SKIP -1
ENDIF
THISFORM.Refresh
ENDIF
Extending the Data Entry Form
To create a more robust data entry form, one that makes it possible for a user to cancel changes or makes it possible for multiple users to access the same data, you need to use transactions and table or row buffering.
See Also
Tasks
Create a Query-By-Example Form Sample
Create a One-To-Many Data Entry Form Sample
Reference
Visual FoxPro Foundation Classes A-Z