Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Appending Records To A Table with append and scatter memvar
Message
From
12/04/2002 01:58:47
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Appending Records To A Table with append and scatter memvar
Miscellaneous
Thread ID:
00644109
Message ID:
00644109
Views:
64
I would like to know how I can append records to a table from a form using the FoxPro Append command.

I have a form with with a single table in the data environment and three fields on the form. One of the fields is the primary index. The control source of each text box is linked to the appropriate table field. I have a Add and Save button on the screen. The following code is attached to the Add Button:

THISFORM.txtApp_code.VALUE = ""
THISFORM.txtApp_name.VALUE = ""
THISFORM.txtApp_owner.VALUE = ""

SELECT SecMod


SCATTER MEMVAR MEMO

The following code is attached to the Save button:
app_code = THISFORM.txtApp_code.VALUE *app_code is name of table field
app_name = THISFORM.txtApp_name.VALUE
app_owner = THISFORM.txtApp_owner.VALUE

APPEND BLANK
GATHER MEMVAR

When I have entered data into the text boxes and I click on the Save button, the program boms out with the error "Uniqueness of index App_code violated". A blank record is created and the contents of the first record of the table is overwritten with that which I just entered. It would appear to me that the record pointer is in the wrong position. How do I get the record pointer to point to the blank record and save the data there? If I remove the control source links in the text boxes, I do not get this error. But with this done, the text boxes are not populated with any data when the form is loaded.

How do I solve this problem or is there a better method of doing this? I would really appreciate help with this
Stuart Reid

True nobility lies not in being superior to another man, but in being superior to one’s previous self
Next
Reply
Map
View

Click here to load this message in the networking platform