Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grids and error
Message
From
13/10/2006 12:25:27
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01161719
Message ID:
01161808
Views:
27
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
Next
Reply
Map
View

Click here to load this message in the networking platform