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!

Select 'Filename' is baffling me!!!

Status
Not open for further replies.

stanmurphy

Technical User
Oct 14, 2000
89
Hello All,

Looking at the code below, can anyone explain to me why, when I suspend execution at either of the "DO FORM" statements, I am not at the file named APPT (according to ALIAS())? I am absoulutely stymied by this.

APPT has buffering set to 2 in my MAIN program using:

Use Appt in 0
CursorSetProp("Buffering",2,'APPT')

Any insight would be most appreciated!!

Thanks,

Stan





*********************************************
SELECT Appt && the Appointments File
SET ORDER TO byAll && CounName, ApptDateTime
GO top

&& Counsellor Name, Month, Day, Year and Time
STORE (schedule.text&pGridNumberPlusOne..value) TO mCounsellorName
STORE ALLTRIM(mCounsellorName) TO mName
STORE &mCurrentGridName..curApptDate TO mSeekDAte
STORE ALLTRIM(TTOC(mSeekDate,2)) TO mTime
STORE mName+mMONTH+"/"+mDAY+"/"+mYEAR+" "+mTime TO mSEEK

SEEK mSEEK

IF !FOUND() && Appt doesn't exist, so we'll add it
SELECT appthours
GO recno('&mCurrentGridName.')
STORE appthours.hourtime TO mPeriodTime
SELECT APPT
APPEND BLANK && Add a new blank record
replace NEXT 1 appt.apptdatetime WITH;
DATETIME(YEAR(dtCurrentDate),MONTH(dtCurrentDate),;
DAY(dtCurrentDate),VAL(SUBSTR(mPeriodTime,1,2)),VAL(SUBSTR(mPeriodTime,4,2)),00)
replace NEXT 1 appt.counname WITH schedule.text&pGridNumberPlusOne..value
DO FORM ApptDisplay
ELSE && We've found the record
DO FORM ApptDisplay
ENDIF
*************************************************
 
Hi
Check your FORM.. ApptDisplay
If that forms... DataSession = 1 .. it is correct
if that is 2.. you are will not get the default table avauilable.
:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
All forms have DataSession set to Default and BufferMode set to None.
 
Hi Murphy,

Is there any table mentioned as the InitialSelectedAlias in the form ApptDisplay DataENvironment. Or have you added any table in that forms data environment.

Another thing is.. for testing purpose.. why dont add the code in the init event of ApptDisplay form

Init Event
SELECT Appt

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Ok, when I added the INIT code, APPT is now selected. But it is not on the same record as is was in the calling form. It's on the 1st record. Do I have to do a seek in the called form as well?

Thanks for the help :)
 
I spoke too soon. Sometimes the SELECT works, and sometimes it doesn't. I put a SUSPEND in just before the SEEK in the above code, and ALIAS() does not return 'APPT' most of the time.
 
HI


*********************************************
** Add the code here
IF !USED("APPT")
USE APPT IN 0 ALIAS APPT
ENDIF
**
SELECT Appt && the Appointments File
SET ORDER TO byAll && CounName, ApptDateTime
GO top

etc etc..

Hope this helps.. May be somewhere along before the codes.. you have some routine.. while linking out and getting back..closes all tables open.

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
I've modified the code as shown below. When it runs, the program suspends and ALIAS() shows another file name (not 'APPT' as it should) and if I step through the seek, it fails to find the record. However, if when suspended I set the pointer back to the statement before the SELECT, and then step into it, the SELECT works, the seek works, and everything is fine. As far as I can see, there is no reason that the SELECT should be skipped over while the rest of the code in the block is processed??? I even removed the select statement and re-entered it in case there were some weird invisible characters making the program jump over it. No difference. HELP!!!!


**********************************************
&& Counsellor Name, Month, Day, Year and Time
STORE (schedule.text&pGridNumberPlusOne..value) TO mCounsellorName
STORE ALLTRIM(mCounsellorName) TO mName
STORE &mCurrentGridName..curApptDate TO mSeekDAte
STORE ALLTRIM(TTOC(mSeekDate,2)) TO mTime
STORE mName+mMONTH+"/"+mDAY+"/"+mYEAR+" "+mTime TO mSEEK


SELECT APPT
SET ORDER TO byAll && CounName, ApptDateTime
suspend
SEEK mSEEK

IF !FOUND() && Appt doesn't exist, so we'll add it
SELECT 'appthours'
GO recno('&mCurrentGridName.')
STORE appthours.hourtime TO mPeriodTime
SELECT 'APPT'
SET ORDER TO
APPEND BLANK && Add a new blank record
replace NEXT 1 appt.apptdatetime WITH;
DATETIME(YEAR(dtCurrentDate),MONTH(dtCurrentDate),;
DAY(dtCurrentDate),VAL(SUBSTR(mPeriodTime,1,2)),VAL(SUBSTR(mPeriodTime,4,2)),00)
replace NEXT 1 appt.counname WITH schedule.text&pGridNumberPlusOne..value
TABLEUPDATE(0,.t.,'appt')
MESSAGEBOX("record not found",0)
DO FORM ApptDisplay
ELSE && We've found the record, so let's lock it and edit it below
SELECT 'Appt'
MESSAGEBOX("record found",0)
DO FORM ApptDisplay
ENDIF
 
To answer ramani, when I suspend in the code above I can select APPT from the command line so it's still open.
 
I put MESSAGEBOX("The Current File is "+ALIAS(),0)
just after the first SELECT, and the message says that ALIAS() is reporting APPT. But when I suspend a few lines later, the ALIAS() I have in the watchlist of the debugger says something else and if I step through the code, the SEEK returns false.
 
smurphy

To answer ramani, when I suspend in the code above I can select APPT from the command line so it's still open.

What doesn't open? The form? Or the table?
If its the form does it open in it's own?
If its the table can you replace the suspend by a browse and see if that table browses... Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Mike, even though I select APPT in the calling program, when I suspend the second form and do an ALIAS(), APPT is not the current workspace. I don't understand why.

All the trouble started when I began using Buffering in the program. I think I may just go back to manual locking until I understand all the inn and outs of buffering.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top