Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Y/N fields displayed in checkboxes in grid
Message
From
05/03/2007 12:11:23
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Y/N fields displayed in checkboxes in grid
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01200782
Message ID:
01200782
Views:
87
Hello Chaps

This continuing problem I have of FPD2.6 tables (from a legacy, still used system) that I'm using in my replacement for the old system. For some reason, the author made Y/N char fields rather than logical. I want to display certain child recs in a grid, and allow edit thereof.

I populate the grid in the following manner:
With Thisform
  lcAlias	  = ALIAS()
  Select JNYSTAGE  
  lcFilter = "OPERATOR = " + STR( .nOperator, 3, 0) + ;
  	    " and ROUTE = '" + .cRoute + "'" + ;
  	    " and MCL_RTE = '" + .cMCL_Rte + "'"
  Set Filter To &lcFilter
  Locate
  With .pgfMainPageFrame.Page3
    With .grdJnyStage
      .Column1.chkCheck1.Value = IIF( JOURNEY	= "Y", .T., .F.)
      .Column4.chkCheck1.Value = IIF( STAGE 	= "Y", .T., .F.)
      .Column7.chkCheck1.Value = IIF( MON	= "Y", .T., .F.)
             ...	        tue, wed, thu, etc.
...
and, after edit, HOPE to save it as follows:
If sysCONFIRM(	"Save changes to Journey Stages Table?", ;
		"Confirm Save Changes")
    Select JNYSTAGE
    Locate 
    If not RLOCK()
	= sysWARNINGMESSAGE( "Sorry.  Unable to update the Journey Stages Table." + CHR(13) + ;
			   "Another User has the table open for edit.", ;
			   "Cannot Update Journey Stages")
    Else
	With this.Parent 
           With .grdJnyStage
	    Replace JOURNEY with IIF( .Column1.chkCheck1.Value,	 "Y", "N")
	    Replace STAGE   with IIF( .Column4.chkCheck1.Value,	 "Y", "N")
	    Replace MON     with IIF( .Column7.chkCheck1.Value,	 "Y", "N")
             ...	        tue, wed, thu, etc.
             .Refresh()
	  EndWith 
	  = TABLEUPDATE( .T.)
	  UNLOCK
    EndIf
EndIf
Trouble is: All recs in the grid get saved in the same permutation of checks as the 1st record and don't necessarily follow the underllying data. I've tried putting the Replaces in a scan-endscan, but what happened then was the children of the parent rec 3 got copied to those of parent rec 5, and removed from those of parent rec 3, and then only the top rec (out of 2 in this case).

Now then, to predict the obvious questions:

Each "checkbox" column has no .ControlSource (that just gives a data type m-m error anyway) and is not .Bound

I'm probably missing something simple here (I'm not sure I've ever had to do this) - What can it be?

'ppreciate it

Terry
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Next
Reply
Map
View

Click here to load this message in the networking platform