Search This Blog

Showing posts with label table. Show all posts
Showing posts with label table. Show all posts

Delete Data in a Table Code

Deleting data from the local table.

SET EXCLUSIVE ON
USE "C:\EMPLOYEE\DATA\EmployeeList"
DELETE ALL
PACK

Export Code

Use this code when you want to export data from table to Excel File. Plus with a message box informing you if you want to do so. There is also a message box that telling you that you have successfully exported your table to an Excel File.

lAnswer = MESSAGEBOX("Generate Report, do you wish to continue?", 4, "Generator")
IF lAnswer = 6
SELECT SeafarerList
=REQUERY("SeafarerList")
COPY TO "C:\SEAFARER.XLS" XL5
=MESSAGEBOX("File successfully generated.", "Successful")
ENDIF

Add, Save , Replace Code

Sample of save, add, append and replace code:

Select PERSONALINFO
Replace NAME With Thisform.Text1.Value
Replace AGE With Thisform.Text2.Value
Replace BIRTHDATE With Thisform.Text3.Value
Replace BIRTHPLACE With Thisform.Text7.Value
Replace ADDRESS With Thisform.Text8.Value
Replace LANDLINE With Thisform.Text9.Value
Replace CELLPHONE With Thisform.Text10.Value
Replace EMAIL With Thisform.Text11.Value
Replace WEBSITE With Thisform.Text12.Value

SELECT TableName
APPEND BLANK
REPLACE FieldOne WITH THISFORM.TEXT1.VALUE
REPLACE FieldTwo WITH THISFORM.TEXT2.VALUE
REPLACE FieldThree WITH THISFORM.COMBO1.VALUE
REPLACE FieldFour WITH THISFORM.COMBO2.VALUE
INSERT INTO TableName (FieldOne, FieldTwo, FieldThree,FieldFour);
VALUES (THISFORM.TEXT1.VALUE, ;
THISFORM.TEXT2.VALUE, ;
THISFORM.TEXT3.VALUE, ;
THISFORM.TEXT4.VALUE)

Second saving a data by Edit:

SELECT TableName
REPLACE FieldOne WITH THISFORM.TEXT1.VALUE
REPLACE FieldTwo WITH THISFORM.TEXT2.VALUE
REPLACE FieldThree WITH THISFORM.COMBO1.VALUE
REPLACE FieldFour WITH THISFORM.COMBO2.VALUE
INSERT INTO TableName (FieldOne, FieldTwo, FieldThree,FieldFour);
VALUES (THISFORM.TEXT1.VALUE, ;
THISFORM.TEXT2.VALUE, ;
THISFORM.TEXT3.VALUE, ;
THISFORM.TEXT4.VALUE)