Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select Data in Grid
Message
From
01/12/2001 16:53:43
 
 
To
01/12/2001 16:10:49
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00588432
Message ID:
00588436
Views:
17
Hello Peter.

>> I have place the anciliary staff table in a grid ,add a new column and place a checkbox as the current control and there is no control source. The purpose of this checkbox when the user click the checkbox the assigned supevisor's code will be added to this record or removed. <<

You can call a custom method from the valid of the checkbox to modify the current record in the inerlying RecordSource like this:
*** First you must set focus to another object on the form
*** Otherwise you will get error 109 - record is in use by another
*** even if this is a single user app
LOCAL lUpdating
*** Set flag because the SetFocus() line
*** will cause the valid to fire again and we'd
*** like to avoid an infinite loop
lUpdating = .T.
IF NOT lUpdating
  Thisform.SomeOtherControl.SetFocus()
  REPLACE < supervisor code field > WITH < some value > IN ( This.Parent.Parent.RecordSource )
  This.Parent.SetFocus()
  lUpdating = .F.
ENDIF
This code is untested and off the top of my head, but it should give you a place to start. Alternatively, you could create a view with a field called lSelected and bind the column with the checkbox to that. Then, if you have a 'Save' button on the form, you could loop through the grid's RecordSource and REPLACE the supervisor codes for all records where lSelected is true and TABLEUPDATE() the entire table afterward. Personally, if it were me, this is how I would handle it.

HTH
Previous
Reply
Map
View

Click here to load this message in the networking platform