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

Setting autoyield to .F. causes problems in working code.

Status
Not open for further replies.

mdugan

Programmer
Dec 30, 1999
3
US
I am using a third party Active X Control from DBI Technology called Solutions Schedule 3.0. I first wrote code to query a database and then fill in fields in the control. This code worked fine until I set autoyield equal to .F. Now the code fails with the following error...<br>
<br>
Alias 'COLS' is not found. Line #43<br>
<br>
Any suggestions would be helpful. Thanks in advance.<br>
<br>
This is the section of code that is failing...<br>
<br>
SELECT Collections.col_date, Collections.employeeno;<br>
FROM park!Collections;<br>
WHERE ALLTRIM(Collections.route) = ALLTRIM(Sched.route);<br>
ORDER BY Collections.col_date; <br>
Into Cursor Cols<br>
<br>
If Reccount(&quot;Cols&quot;) &gt; 0<br>
<br>
Go top<br>
<br>
Do While !EOF()<br>
<br>
*** THIS LINE EXECUTES SUCCESSFULLY ****<br>
nBarID = Thisform.ctSchedule1.AddKeyTimeBar(nIndexID, ;<br>
0, ; 1440, ;<br>
Thisform.numdate(Cols.col_date), ;<br>
Thisform.numdate(Cols.col_date), 0)<br>
<br>
*** THIS IS LINE # 43 WHICH GENERATES <br>
*** &quot;Alias 'COLS' is not found.&quot;<br>
*** WHEN autoyield is set to .F.<br>
<br>
cHHNum = SUBSTR(TRIM(Cols.employeeno), LENC(TRIM(Cols.employeeno))-2,3)<br>
thisform.ctSchedule1.BarText(nIndexID, nBarID ) = cHHNum<br>
thisform.ctSchedule1.BarTextAlign(nIndexID, nBarID ) = 2 <br>
<br>
nCount = thisform.ctSchedule1.AddBarStyle(20, 0) <br>
thisform.ctSchedule1.StyleBackColor(nCount) = RGB(0,255,0) <br>
thisform.ctSchedule1.BarStyle(nIndexID, nBarID ) = nCount <br>
<br>
SKIP IN Cols<br>
ENDDO<br>
ENDIF <br>

 
The code looks correct. The only thing I can see is that your are using a FoxPro Reserved word COLS. Change the cursor database name and try it again.<br>

 
After setting autoyield to .F. the call to Thisform.ctSchedule1.AddKeyTimeBar <br>
caused an event to be fired which was not being fired previously. Within that <br>
event CLOSE TABLES and CLOSE DATABASE were executed. So after <br>
returning from Thisform.ctSchedule1.AddKeyTimeBar with autoyield set to .F.<br>
the CURSOR Cols was no longer available.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top