Thomas Swaney
asked on
VFP 9 hiding value in a grid row/column based on a date in the record
I have a grid in a form that contains a Loan Amount field. Above the grid is a year (2010,2009, etc.) in a combobox. If a year for a date field in the same grid that contains the Loan Amount field is the same as the selected year in the combobox the Loan Amount should show otherwise it shouldn't. I have made this work properly but when I try to edit the value in the Loan Amount field, in the status bar of the application it says that this is read-only. Here is the code that I have put into the INIT of the grid to make the hide/show functionality work properly:
this.column6.ControlSource = + ;
"IIF(ALLTRIM(STR(YEAR(loan .date_req) )) == thisform.pageframe1.page12 .txtPlanYe ar.value, + ;
loan.loan_amt,'')"
Any ideas would be greatly appreciated!
this.column6.ControlSource
"IIF(ALLTRIM(STR(YEAR(loan
loan.loan_amt,'')"
Any ideas would be greatly appreciated!
ASKER
Thanks Olaf.
I have tried this adding two textbox controls to the grid column and adding the code that you suggested to the Init of the grid.
Unless I add the controlsource of loan.loan_amt for the grid column it shows the first column from the loan table as the value in the grid column.
Text1 has a controlsource of loan.loan_amt
Text2 has a empty controlsource.
So in other words it is still not working properly. I could maybe try another control but I would think that I would get the same results.
Have you got a application that this is working in currently or have you tested it?
Thanks,
Thomas
I have tried this adding two textbox controls to the grid column and adding the code that you suggested to the Init of the grid.
Unless I add the controlsource of loan.loan_amt for the grid column it shows the first column from the loan table as the value in the grid column.
Text1 has a controlsource of loan.loan_amt
Text2 has a empty controlsource.
So in other words it is still not working properly. I could maybe try another control but I would think that I would get the same results.
Have you got a application that this is working in currently or have you tested it?
Thanks,
Thomas
The controlsource of controls in a grid column rather "inherits" the controlsource of the colun, true. It's mainly the grid that binds to the table, not the inner controls. So what's wrong about setting the column controlsource to loan.loan_amt?
Set column.sparse=.f. perhaps.
I don't see why this would not work, I'll create such a grid now and test.
Bye, Olaf.
Set column.sparse=.f. perhaps.
I don't see why this would not work, I'll create such a grid now and test.
Bye, Olaf.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you. Works great!!
You should rather add an unbound textbox or perhpas even a control without a value property, like a container object to the grid column (eg column.addobject("containe
this.column6.dynamiccurren
"text1","container1")"
And use the controlsource of the column rather than the control within the column.
Bye, Olaf.