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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with checkbox in grid

Status
Not open for further replies.

Judi201

Technical User
Jul 2, 2005
315
US
Hi!

This is my first attemp to use a checkbox in a grid. I have a grid with a checkbox in the last column (7th)

The RecordSource for the grid is an updateable cursor created following Marcia's suggestions in '1001 Things..'
Code:
USE DBF('csrTemp') AGAIN IN 0 ALIAS PayTick
	USE IN csrTemp
	SELECT PayTick

The Value set in the properties for the checkbox is set to .F.

The values show in the grid and I can edit the fields as needed but when I tab into or click the mouse in the checkbox, I get an error:

"Error with chkPay - Value:Data Type Mismatch"

The cursor field is set to .F. in the SELECT query.

I can't catch it in DEBUG. Everything is fine, I click, get the error, and nothing shows in debug.

I am at a loss to know how to catch the problem. As I said - my first attempt.

Thanks for any help.

Judi
 
Dave,

Thanks for the reply. Yes, I have the CurrentControl for the column set to the checkbox.

Judi
 
Dave,

The RecordSource is set in the Valid of the object immediately before the grid in the tab order. I have used this setup in many forms before as a selection is being made there on what to present in the grid. (All or Selected) This happens to be a checkbox on the form.

Judi
 
This is somehow ringing a bell, but I can't put my finger on it.
Maybe run through your form and see if there's a stray variable laying around named 'chkPay'. It seems like I had a similar issue with it going out of scope. Even though there was a field with the same name.
You may want to double-check the properties sheet too. See if there's a stray control with that as a property somewhere.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Dave,

OK, I found the problem. I was actually one column off in setting up my cursor, even tho it appeared to be right.

Thanks for the help.

Judi
 
Hi!

Maybe I should start a new thread but I don't know how to describe my problem in a title.

In the grid described earlier, I click the checkbox and a value is updated in several places. (The code is in the click of the checkbox) This works fine in the first row that I click whether it is the first row or not.

After that each update uses the save value. I am using:

Code:
DODEFAULT()
IF This.Value = .T.
	This.Parent.Parent.column6.text1.Value ;
	= This.Parent.Parent.column3.text1.Value
ENDIF
KEYBOARD '{DNARROW}'

Am I not understanding something here? Is the code in the best place?

Any suggestions much appreciated.

Judi
 
Dave,

Checkbox is in column 7. On check, I want to copy value from column 3 to column 6. This works fine the first time I click on any row. Say I click on first row checkbox. OK. Value in column 3 copied to column6. If I then click on checkbox in column 7 in the second row in the grid (now the active row) the value in column 6 changes to the same value as in the first row - not column 3 in current row. Confusing I know.

Any ideas?

Judi
 
I get the same result. I had previously tried putting it in InteractiveChange.

I have code to set it back if the checkbox is checked again and that works correctly.

Check one time. OK
uncheck it OK
check same box again OK set back correctly
check another box shows the value of the first checked.
uncheck this box OK

I just don't know.

Appreciate any thoughts.

Judi
 
Dave,

I tried using the same with a REPLACE.
This gives an error 'not a field variable'

I am sure others do this. Is my approach so far out in left field? How else could it do this?

This is the only thing on a very nice screen that I cannot get to work properly.

Thanks.

Judi
 
Dave,

OK, T tried REPLACEing as you said but with the same result.

I have only used GRIDS before to select one row and then act on that. In doing that, I assumed that the values I pulled from the grid would be those on the active row. This always worked when I left the GRID and coded elsewhere.

Somehow, the click on the second row is not picking up new values but saving the old ones. How do I state:

Thisrow.thiscolumn.thistext.thisvalue ?

Stepping thru in DEBUG shows the old values in the .text.values. I just don't understand. Would I need some kind of refresh somewhere?

I do appreciate all of you help.

Judi

Judi
 
Hi!

Just want to close this thread for the benefit on anyone reading it later. (I find so many answers that way that I am always conscious of leaving it hanging)

I never could get this to work so, as I am moving forward in learning new ways, I used a parameterized view for the RecordSource and WOW! things just fell into place. So maybe that is the best way to do something like this.

Judi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top