Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Appending Records To A Table with append and scatter mem
Message
From
11/04/2002 10:33:50
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00643737
Message ID:
00643741
Views:
10
Just forget about memory variable, scatter and gather. Use buffering, and tie the ControlSource directly to the field.

Use TableUpdate() to save changes.

Use TableRevert() to revert changes.

HTH, Hilmar.

>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? I would really appreciate help with this
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform