Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Edit and Add on same Form
Message
 
 
To
28/12/2000 17:34:58
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00457515
Message ID:
00457615
Views:
17
>Hi Mark,
>
>So you set the controlsource of the textbox to the p-view and when you set the parameter to -0 blank controls... Sounds easier to me...
>
>Thanks

The requery of the view with a bogus parameter value gives me a view with no records. I then issue the APPEND BLANK which then enables the form controls. The ControlSource for all the controls always remains bound to the fields in the view. Then a simple TableUpdate() will do the actual insert or a TableRevert() will abort the insert [back out the APPEND BLANK].

>>>Up to now I have had two pages on a form one with textboxes with the control source set to the table for editing and one with the control source not set to anything for adding a new record.
>>>
>>>Am I doing double work?
>>>
>>>Is there a better way? i.e. less coding, less confusion...
>>>
>>>Would it be better to not set the control source of the text box to the table and populate the textboxes with the data then update the record when editing and set a semphor flag to indicate if and edit is in process or creating a new record.
>>>
>>>TIA
>>
>>I use parameterized views. If the user clicks the ADD button, I update the current record if there were any changes, set the parameter of the view to some unrealistic value [e.g., -1 since all my PKs are positive integers.] and issue a REQUERY() on the view. This obviously returns no records. I then issue an APPEND BLANK and ThisForm.Refresh(). If the user cancels the add, I issue a TableRevert().
>>
>>You can do basically the same thing with a table buffered VFP table. You just leave out the parameter value and REQUERY() parts.
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform