Create a Single Table Data Entry Form

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 allows a user to cancel changes or allows multiple users to access the same data, you need to use transactions and table or row buffering. For more information on these features, see Chapter 17, “Programming for Shared Access,” in the Visual FoxPro Developer’s Guide.