On Wed, Feb 20, 2008 at 3:18 PM, "Dave Crozier" wrote:
>
> Garry,
> Definitely QueryUnload as this is ALLWAYS called however you unload the
> form.
>
> Dave Crozier
Hi Dave,
Thanks to you and everyone else for the replies.
I've moved my output code from a timer into a separate form method
called CloseDown:
WITH thisform
ldtCurrent = DATETIME()
lcStatus = .txtEventStatus.Value
replace ALL curLPMs.Notes WITH lcStatus
INSERT INTO LPMHistory SELECT *, lcStatus, ldtCurrent FROM curLPMs
IF !EMPTY( .lblRaceDetails.Caption)
.XLSOutput( FORCEEXT( .lblRaceDetails.Caption + [ -
LPMHistory], [xls]))
ENDIF
ENDWITH
thisform.XLSOutput is simply:
LPARAMETERS tcFilename
SET TALK OFF
SELECT * FROM LPMHistory INTO CURSOR curXLSOutput READWRITE
CALCULATE MAX( LEN( TRIM( curXLSOutput.LPMs))) TO lnLPMLen
IF lnLPMLen = 0
lnLPMLen = 10
ENDIF
ALTER TABLE curXLSOutput ALTER COLUMN LPMs c( MIN( 254, lnLPMLen))
SET SAFETY OFF
COPY TO ( tcFilename) FIELDS EXCEPT NewLPM TYPE XLS
SET SAFETY ON
USE IN curXLSOutput
In the forms QueryUnLoad method, I have only: thisform.CloseDown
This works fine for when the user clicks the X in the top-right corner
of the form - the XLS file is created.
However, if the market is closed - the code that handles this is in a
timer - it doesn't work:
WITH thisform
IF UPPER( ALLTRIM( .txtMarketStatus.Value)) != [CLOSED]
.cmdGetMarket.Click
This.Reset
ELSE
.cmdPauseResume.Click
SELECT curLPMs
.Destroy
ENDIF
ENDWITH
I get Error 52 "No table is open in the current work area." in
thisform.CloseDown, Line #4 and Error 1 (!) "File 'curlpms.dbf' does
not exist." in thisform.CloseDown, Line #5.
?
Cheers,
Garry
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.