Hi William,
Unfortunately I can’t give you a very detailed response.
Here are some specific answers:
-Your code is probably OK.
-There are many other ways.
-I believe the “recommended” buffering mode is 5 (table/optimistic)
-Remove the GO BOTTOM statement after APPEND BLANK
-You should use custom properties of the form instead of memory variables for adding/editing
Here are some general answers:
Yes, you need to understand what you are doing - you didn’t want to hear that :)
Our way to refresh our controls and buttons is:
-use the refresh method of buttons for enabling/disabling
if thisform.adding or thisform.editing
this.enabled=.T.
else
this.enabled=.F.
endif
Depending on the button, the .T.,.F. will differ, i.e. we want the
navigation buttons disabled while editing, but the save button enabled.
-use the when method of data bound controls to control access
return (thisform.adding or thisform.editing)
The ideea is that objects should take care of themselves as much as possible.
We have most code at the class level, and it is a little more complex than the above. For example our textbox class will check in the when method code if there is a form property called adding or editing - using pemstatus() - and then use those properties to control access. Our Add button class will enable or disable itself based on editmode rights of the user, will change the caption to Add or Save following a click on it, and will perform the appropriate action of adding a blank record or saving the new record.
It is worth checking UT for articles/books on form design, class design, buffering…
I’ll be on vacation for the next month, so I won’t be able to help more.
Good luck,
dz
Doru