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

grid problem

Status
Not open for further replies.

rickesilaw

Programmer
Jun 24, 2002
154
CA
I did search keyword grid but couldn't find answer - has to be something I am doing. I have a grid with proper controlsource etc. I then have this code in init of form but grid is blank.

thisform.clienttime.RecordSource=""
thisform.clienttime.RecordSourceType= 0
thisform.clienttime.RecordSource="fesipatch"
thisform.clienttime.column1.ControlSource=fesipatch.patchno
thisform.clienttime.column4.ControlSource=fesipatch.passfail
thisform.clienttime.column4.Text1.ReadOnly=.F.
thisform.clienttime.column4.ReadOnly=.F.
thisform.clienttime.Refresh()
thisform.Refresh()

what is missing?
 
You show setting the grid's RecordSource to '' and then setting it to 'fesipatch' without rebuilding fesipatch in between. The point of blanking out a RecordSource is to prevent the grid from going blank while you're rebuilding the underlying cursor. I have a feeling you're doing that before you blank out the RecordSource. You need to clear the RecordSource first, then rebuild the cursor, then set the RecordSource back.


-BP (Barbara Peisch)
 
I am using a table as recordsource as I want to modify one field in that table
 
I open tbl in load and this code is init so before
 
Then it's a syntax problem with the code you've posted. On closer inspection I see you don't have quotes around the alias and field name for the column controlsources. That would cause the problem.


-BP (Barbara Peisch)
 
still no luck - see below

thisform.clienttime.RecordSource=""
SELECT 0
USE fesipatch
SET ORDER TO patchno

thisform.clienttime.RecordSourceType= 0
thisform.clienttime.RecordSource="fesipatch"
thisform.clienttime.column1.ControlSource="fesipatch.patchno"
thisform.clienttime.column4.ControlSource="fesipatch.passfail"
thisform.clienttime.column4.Text1.ReadOnly=.F.
thisform.clienttime.column4.ReadOnly=.F.
thisform.clienttime.Refresh()
thisform.Refresh()
 
If you're sure there's no typo in your field names, try changing the RecordSourceType to 1 - Alias. I always use that setting, even when I'm using a table.


-BP (Barbara Peisch)
 
ok tried 1 but still blank - so took out all code, added tbl to environment and bound to grid - now i get grid filled with first record only if recordsource 0 and will all records if 1!

This works but I still prefer to set after form is open. Thanks for all your help.
 
This works but I still prefer to set after form is open.

And you should be able to. I do this with grids all the time. I'm not sure what's wrong though. At least you have a workaround.


-BP (Barbara Peisch)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top