Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple records update validation question
Message
From
16/05/2007 12:38:12
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01226060
Message ID:
01226077
Views:
20
This message has been marked as a message which has helped to the initial question of the thread.
>Hi everybody,
>
>This would be a basic question, but I want to get some ideas here.
>
>I have a form with a grid and some regular controls (combos and editbox) above the grid for editting. I can navigate through the records and edit multiple records. I also can add new records, though in my design I have to save parent first, if I also want to add children.
>
>Anyway, how should I check for validity of the data (new and updated) in such case?
>
>I found several records saved without description and though I do have ValidateInfo method in the form, it validates the current record only.
>
>So, I guess, I may have to use LostFocus event of a container and put fields for editting in the extra container?
>
>What other alternatives do I have here?
>
>Loop through all modified records and check them?
>
>Thanks in advance.


I would
- take the focus off the grid
- select grid.RecordSource
- Success = TRUE
- scan all while Success
    Success = ValidateInfo()
  endscan

do case
case !m.Success

otherwise
    begin transaction
    save the lot
    
    if( SomeErrorDuringSave )
      rollback
    else
      end transaction
    endif

endcase
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform