Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding a new record
Message
From
28/10/1997 15:24:32
 
 
To
28/10/1997 15:08:01
Edward Crawford
City Facilities Management
Glasgow, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00057062
Message ID:
00057076
Views:
30
>The way I used to add a new record to a table was the user would fill in the fields, and then press SAVE. The system would then APPEND BLANK and REPLACE.
>
>By using .ControlSource, however, I have to APPEND BLANK first before the user can add anything to the table. If, however, the user changes their minds about adding a new record, a blank record is still in the table. I could check key fields, and if they are blank delete the record, but I was wandering about how everyone else is adding a new record to a table. Any input?
>
>Ed

This question has also been touched upon here recently.
There are many answers to this question, and for the most part it depends on preference and needs of the system. The way I currently handle it is much like you describe, but before I delete the record, I check GETFLDSTATE and ask the user if she is sure she wants to clear her entry. The disadvantage of this is that clicking add and then undo adds blank deleted records into the table. Not too big of a deal if it doesn't happen 2000 times a day. I am slowly trying to migrate away from this approach for a couple of reasons. Another method does not use the controls' controlsource at all, but populates all of the controls with code when the record pointer moves. When adding a record, simply blank the controls and put the form in edit mode. When saving, the record is added using INSERT. Even though this approach obviously takes more code and/or more thought in design of framework, Ed has convinced me that it is better in the end.
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform