Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grids and error
Message
From
13/10/2006 12:53:38
 
 
To
13/10/2006 12:50:35
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01161719
Message ID:
01161828
Views:
28
>Whether the problem is more pronounced in VFP9 or not, I really can not tell. Anyway, the procedure I described has been the recommended procedure for many, many years. Persoanlly I have used it since VFP6, or meybe even before that. Better safe than sorry! :-)

The important thing is NEVER set recordsource to nothing, because you lose the "foundation" of the grid, and you must practically recreate the whole grid from scratch.

>
>>Apparently those problems are much more pronounced under VFP9 than VFP8 (code worked fine there). I've converted to the way you suggested. I'm hitting a couple of snags there but I'm going to see what I can work through first.
>>
>>
>>
>>>You're doing the classical RecordSource='' (nothing) procedure which causes a lot of problem. In stead base your grid on a cursor which exists before you create the grid. When you need to select new data:
>>>1. Select whatever ... into cursor curDummy (your SQL select)
>>>2. Select yourGridCursor
>>>3. zap
>>>3. append from dbf('curDummy')
>>>4. yourgrid.refresh
>>>
>>>>All of the below is contained within a WITH_ENDWITH on the grid.
>>>>
>>>>
>>>>	IF USED('curDisplay')
>>>>		lnCurrentRow = RECNO('curDisplay')
>>>>
>>>>	ELSE
>>>>		lnCurrentRow = 1
>>>>	
>>>>	ENDIF
>>>>	
>>>>	lsSQL = 	"SELECT curWorking.UniqueID, curWorking.IsSelected, " +;
>>>>			"curWorking.Invert, curWorking.IsRestricted, " +;
>>>>			"!ISNULL(curWorking.Annotation) as HasNote," +;
>>>>			"TTOD(curWorking.ClearDate) AS ClearDate, curRecon.SWDN, " +;
>>>>			"curRecon.PrimaryDoc, curRecon.CAAmount, curRecon.DAAmount, " +;
>>>>			"curRecon.AuditDate, " +;
>>>>			"curRecon.MachineDate, curRecon.SecondaryDoc, curRecon.Site, " +;
>>>>			"curRecon.Source, curRecon.GLC, curRecon.ReconMonth, " +;
>>>>			"curRecon.TransactionType, curRecon.LastRFA " +;
>>>>		   	"FROM curWorking " +;
>>>>		   	"INNER JOIN curRecon ON curWorking.UniqueID = curRecon.UniqueID " +;
>>>>		   	"INTO CURSOR curDisplay READWRITE " +;
>>>>		   	"WHERE ISNULL(curWorking.MatchedTo) AND " +;
>>>>		   	"curRecon.RecordType = '" + lsRecordType + "' AND " +;
>>>>			"ALLTRIM(curRecon.Account + NVL(curRecon.CFI,'')) == '" + lsAccount + "' "+;
>>>>			IIF(THIS.Parent.chkDisplayCleared.Value, "" ,;
>>>>				"AND ISNULL(curWorking.ClearDate) ") +;
>>>>			"ORDER BY " + .SortOrder + " " + .SortDirection
>>>>
>>>>	.RecordSource =  ''
>>>>
>>>>	&lsSQL.
>>>>
>>>>	IF !USED('curDisplay')
>>>>		MESSAGEBOX("The Display cursor failed. Contact programmer. DO NOT CLOSE THIS!" + CR+;
>>>>				lsSQL)
>>>>
>>>>	ENDIF
>>>>
>>>>	.RecordSource = 'curDisplay'
>>>>	.grcSelect.ControlSource = 'curDisplay.IsSelected'
>>>>	.grcReversed.ControlSource= 'curDisplay.Invert'
>>>>...
>>>>
>>>>
>>>>I'm also trying it with the permanent cursor method... BUT I'm running into a case where it's doubling the records. That may be a case of me running through some of the nuances of that method.
>>>>
>>>>Richard
>>>>
>>>>
>>>>
>>>>>>The Form will open and display data. It is happening during a requery of the data source. Similar code works throughout this application with zero problems. I did have a problem at one point with losing my columns but that problem has been solved. This one has just started.
>>>>>>
>>>>>>Possibility of a corrupt Form file?
>>>>>>
>>>>>>Richard
>>>>>
>>>>>What is the source for the grid? Would you please post a bit of code where the problem occurs?
>>>>>
>>>>>AFAIK, if you're using local view for your grid and do requery(), the grid should work just fine. I think the similar case would be with remote views, but I'm not certain.
Previous
Reply
Map
View

Click here to load this message in the networking platform