Defined a form within my program as class, program displays the form, I give it input(some dates)and the program runs on but never releases the form. any tricks to this?
PUBLIC lefffrom,leffto && Book from/to dates & Currency rate
OPEN DATABASE k:\vfp\reinsurance\DATA\mrcdata.DBC SHARED
SET SAFETY OFF && allows overwrite of files
* Prompt for effective dates
*Release oFrmDate
public oFrmdatepick
oFrmDatePick = CREATEOBJECT("frmdatepick"
oFrmDatePick.Show
return
**************************************************
*-- Form: frmdatepick
*-- ParentClass: form
*-- BaseClass: form
*:******************************************************************************
*:
*: Class:frmdatepick BaseClass: form
*:
*:******************************************************************************
Define CLASS frmdatepick AS form
Add OBJECT Label1 AS label WITH ;
AutoSize = .T., ;
FontName = "MS Sans Serif", ;
FontSize = 8, ;
Caption = "Enter effective dates",;
Height = 19, ;
Left = 50, ;
Top = 15, ;
Width = 79, ;
TabIndex = 1, ;
Name = "Label1"
Add OBJECT LABEL2 AS label WITH ;
AutoSize = .T., ;
FontName = "MS Sans Serif", ;
FontSize = 8, ;
Caption = "\<From:", ;
Height = 15, ;
Left = 10, ;
Top = 39, ;
Width = 28, ;
TabIndex = 2, ;
Name = "Label2"
Add OBJECT txtefffrom AS textbox WITH ;
FontName = "MS Sans Serif", ;
FontSize = 8, ;
dateformat = 1,;
datemark = "/",;
Height = 23, ;
inputMask = "99/99/9999",;
Left = 49, ;
TabIndex = 3, ;
Top = 35, ;
Width = 72, ;
Name = "txtefffrom"
Add OBJECT Label3 AS label WITH ;
AutoSize = .T., ;
FontName = "MS Sans Serif", ;
FontSize = 8, ;
Caption = "\<To:", ;
Height = 15, ;
Left = 10, ;
Top = 70, ;
Width = 18, ;
TabIndex = 5, ;
Name = "Label3"
Add OBJECT txteffto AS textbox WITH ;
FontName = "MS Sans Serif", ;
FontSize = 8, ;
dateformat = 1,;
datemark = "/",;
Height = 23, ;
inputMask = "99/99/9999",;
Left = 49, ;
TabIndex = 4, ;
Top = 66, ;
Width = 72, ;
Name = "txteffto"
Add OBJECT cmdOK AS commandbutton WITH ;
Top = 100, ;
Left = 254, ;
Height = 23, ;
Width = 72, ;
FontName = "MS Sans Serif", ;
FontSize = 8, ;
Caption = "OK", ;
Default = .F., ;
TabIndex = 5, ;
Name = "cmdOK"
Procedure cmdOK.Click
Public leffFrom,lEffTo
*!* First, get the values the user entered into the combo boxes.
lEffFrom = ctod(THISFORM.txtEffFrom.value)
lEffTo = ctod(THISFORM.txteffto.value)
SELECT claims.pc,claims.insured,claims.claimant,;
ledger.uw,ROUND(MTON(SUM(ledger.osloss)),2) AS osloss,;
ROUND(MTON(SUM(ledger.osexp)),2) AS osexp,;
ROUND(MTON(SUM(ledger.lospd)),2) AS lospd,;
ROUND(MTON(SUM(ledger.losded)),2) AS losded,;
ROUND(MTON(SUM(ledger.lossir)),2) AS lossir,;
ROUND(MTON(SUM(ledger.exppd)),2) AS exppd,;
ROUND(MTON(SUM(ledger.lospd+ledger.lossalv+ledger.losded+ledger.lossir)),2) AS paidsalv,;
ROUND(MTON(SUM(ledger.lospd+ledger.lossalv+ledger.losded+;
ledger.lossir+ledger.exppd+ledger.osloss+ledger.osexp)),2) AS incurred,;
IIF(ledger.claim<>0,ALLTRIM(STR(claims.claim))+"-"+ PADL(claims.clmsub,2,'0'),SPACE(10)) AS clmno,;
contracts.ctrtype1, (contracts.ctrprefix+alltrim(str(contracts.ctrpoolno))+contracts.subletr) as contract,;
contracts.rptgroup, ctrstatus.ctrsts, claims.claim AS clm7,dtoc(LEFFFROM) AS EFFFROM, dtoc(LEFFTO) AS EFFTO;
FROM mrcdata!claims;
inner JOIN mrcdata!contracts ON;
claims.ctrprefix = contracts.ctrprefix AND;
claims.ctrpoolno = contracts.ctrpoolno AND;
claims.subletr = contracts.subletr AND;
claims.uw = contracts.uw;
LEFT OUTER JOIN mrcdata!ledger ON;
claims.claim = ledger.claim AND;
claims.clmsub = ledger.clmsub;
inner JOIN mrcdata!ctrstatus ON;
contracts.ctrsts = ctrstatus.ctrsts;
WHERE claims.pc="PF" AND;
ledger.effdate >= lefffrom AND;
ledger.effdate <= leffto;
ORDER BY claims.pc,contracts.ctrtype1,claims.insured,claims.claimant,ledger.uw, clmno;
GROUP BY claims.pc,contracts.ctrtype1,claims.insured,claims.claimant,ledger.uw, clmno;
INTO TABLE k:\vfp\reinsurance\temp\wklyassmdet.DBF
USE
* RUN TO EXCLUDE ASSUMED CLAIMS FROM MATCHING UP IN REPORT
SELECT claims.claim,PADL(claims.clmsub,2,'0') AS clmsub,claims.ctrpoolno,claims.clmsts;
FROM mrcdata!claims;
WHERE ctrprefix=" " AND claims.pc="PF" AND claims.clmsts <> "I";
ORDER BY claims.claim, claims.clmsub;
INTO TABLE k:\vfp\reinsurance\temp\wklyassdetsubs.DBF
USE
* PRINT REPORT
oCRApp = createobject("crystal.crpe.application"
oRep = oCRApp.openreport("k:\vfp\reinsurance\reports\30PF.rpt"
oRep.Printout(.F.)
It may also be a problem that the Crystal application is not finished its work while you are trying to release the form. As a test I would remove the thisform.release from the command button, create another one and just put thisform.release in it, and once the print out is finished, try and release your form.
Mike Gagnon
If you want to get the best response to a question, please check out FAQ184-2483 first.
They fail to close if you have any public variables created in LOAD or INIT. It also seems to only effect variables pointing to objects not base types.
If you release your variables first it should work.
e.g.
RELEASE oCRApp
ThisForm.Release ( or Release thisform )
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.