Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating Fields In A Grid 2

Status
Not open for further replies.

drosenkranz

Programmer
Sep 13, 2000
360
US
Hello,

I'm using VFP 7.0 (SP1). Where would you place the code in a grid to validate fields that you want to require an entry - IF the user never got "focus" on that particular control?

1) Would I want to make the field in the database use a "rule" ?

2) Is there a way to "Valid-ate" that row's crucial fields when the user moves on to the next record or exits the grid?

3) Follow the lost focus of the grid with a Scan While loop to validate entries?

Thanks,

Dave

The 2nd mouse gets the cheese.
 
Hi Dave,

I always put the validation, just before TABLEUPDATE(). That makes the validation tight and no repetition.

Make a SCAN... ENDSCAN loop of the grid and validate all the records. If anything is wrong, send back to that row focused.

A grid can be exited in many ways.. by pressing ESC, by directly clicking on the Save or Cancel buttons or such other options, by closing the form by clicking at the top x button... WHereever it is, doing the TABLEUPDATE() is the place where the real update takes place and so, just prior to it do the validation.

There could be cases, where you have to decide on the next column or such controls which need what was the value in some other column. In such cases, do the validation in the lost control of the relevent textbox or control.

:)

ramani :)
(Subramanian.G)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top