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

Grid on form comes up blank on third access.

Status
Not open for further replies.

sfr10000

Programmer
May 22, 2006
12
0
0
DO
I have a form which is called from a top level form. It has 2 grids based on two different tables. I access the form the first time and the data in the first grid displays normally. I access the form the second time and the data data from the second grid displays normally. I access the form once more and atttempt to display the data from the first table in the first grid and the grid is blank. Text fields on the same form which display data from the same table function normally. Nothing I do in the way of refreshing the grid causes the data to display in the grid. The only thing that causes the data to display again is returning to the top level form and then calling the form with the problem grid.
 
Are you recreating grid's recordsource at any point after you display it correctly and before the grid goes blank? By recordsource, I mean the cursor that is used to populate the grid. If this cursor is destroyed and then recreated, the grid will lose its columns, giving the appearance of a blank grid.

If this sounds like it might be the case, you should set the RecordSource property to a blank string just before you recreate the cursor, and set it back to the cursor's name afterwards.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
I know what you are describing and I have seen this before and successfully set the recordsource to space(0). However, this time I set the recordsource on the grid to space(0) everywhere just before releasing the form with no improvment, although I would think that once the form was released this fix would not have any effect. I do release the form every time after I access the form and view the information on a grid. Also the recordsource is a table which never gets zapped and is open at all times. Only the order of the table is modified between accesses.
 
I access the form the first time and the data in the first grid displays normally. I access the form the second time and the data data from the second grid displays normally. I access the form once more and atttempt to display the data from the first table in the first grid and the grid is blank.
Little confused here, what exactly do you mean by "access"? Correct me if I am wrong here:
You have a Single form with 2 grids whose recordsource's are 2 different tables... Correct?
This form is being called from a "parent" (top level does not matter) form ...correct?
If so:
Is the parent form doing a Seek, Locate etc on the 2 tables? If it is maybe the first grid's table does not meet the condition.
Do you have the table names hardcoded into the Grids recordsource? i.e. grid1.recordsource = <<tablename>>
If yes, in the Forms Init() do a Grid1.refresh, grid2.refresh.
If No, where are you setting the Recordsource?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top