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!

File SELECT Mystery !!

Status
Not open for further replies.

stanmurphy

Technical User
Oct 14, 2000
89
Hello All,

The following code is the beginning of a program that is called from the Click Event of the textbox control in a single column grid.


***************************************
PROCEDURE EditAppt
PARAMETERS pGridNumber

PRIVATE mDay,dtCurrentDate, mThisGrid, mMonth, mYear, mSeek

STORE "curGridcursor"+ALLTRIM(STR(pGridNumber)) TO mThisGrid
STORE CTOD(schedule.pcurrentday) TO dtCurrentdate
STORE ALLTRIM(STR(DAY(curGridCursor1.curApptDate))) TO mDay
IF LEN(mDAY) = 1
mDAY = "0"+mDAY
ENDIF
STORE ALLTRIM(STR(MONTH(curGridCursor1.curApptDate))) TO mMonth
STORE ALLTRIM(STR(YEAR(curGridCursor1.curApptDate))) TO mYear

SELECT APPT && the Appointments File
SET ORDER TO ByAll && CounName, ApptDateTime
GO top

STORE ALLTRIM(curGridCursor1.curcounname)+;
mMONTH+"/"+mDAY+"/"+mYEAR+" "+TTOC(curGridCursor1.curApptDate,2) TO mSEEK
SEEK mSEEK
**************************************************

As you can see, I am explicity calling the table called APPT. However, by the time the SEEK is executed, ALIAS() displays the name of the cursor that feeds the grid, not the APPT table. I don't understand why I don't get an error on the SET ORDER TO if APPT is not actually the current workspace.

The tables are opened in my MAIN program.

I'm baffled. Any ideas??

Thanks
 
You probably have a private datasession associated with your form that gets used separately from the tables you've already opened.
Dave S.
 
Nope. All forms are set to Default Datasession.

The odd thing is, if I set a breakpoint on the SELECT, then step through, everything works. But not when I let it run free.
 
I would suggest placing a breakpoint on DBF("APPT") in the watch window. That would be the easiest way to track down when it opens and closes.
Dave S.
 
Perhaps you should try:

=SEEK('APPT',mSEEK) instead of SEEK mSEEK


Rob.
 
I'll give both of those suggestions a try. Thank you.
 
HI

PROCEDURE EditAppt
PARAMETERS pGridNumber

PRIVATE mDay,dtCurrentDate, mThisGrid, mMonth, mYear, mSeek

STORE "curGridcursor"+ALLTRIM(STR(pGridNumber)) TO mThisGrid
STORE CTOD(schedule.pcurrentday) TO dtCurrentdate
STORE ALLTRIM(STR(DAY(curGridCursor1.curApptDate))) TO mDay
IF LEN(mDAY) = 1
mDAY = "0"+mDAY
ENDIF
STORE ALLTRIM(STR(MONTH(curGridCursor1.curApptDate))) TO mMonth
STORE ALLTRIM(STR(YEAR(curGridCursor1.curApptDate))) TO mYear

STORE ALLTRIM(curGridCursor1.curcounname)+;
mMONTH+"/"+mDAY+"/"+mYEAR+" "+ ;
TTOC(curGridCursor1.curApptDate,2) TO mSEEK

SELECT APPT && the Appointments File
SET ORDER TO ByAll && CounName, ApptDateTime
SEEK mSEEK

Try the above code :) BTW.. what about the LPARAMTER passed and where is this used ?
:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
correction:
=SEEK('APPT',mSEEK)
should be : = seek(mSEEK,'APPT')

Rob.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top