Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP 6.0 Date Problem (She is no angel)
Message
De
07/09/1999 10:21:03
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00261907
Message ID:
00261934
Vues:
23
ldEndDate is declared as LOCAL, meaning that the report won't see it. Do you have any expression inside the report that access ldEndDate?

>Using VFP 6.0, and SP3.
>
>I have been using this type of code since vfp 3.0, and similar code going back to FoxPro 2.0, and have not had a problem, until now.
>A form allows the user to select a date range, and prints a form. When run as a standalone form within VFP, it works correctly, and prints the report as expected. If the main prg or exe are run, then a problem occurs.
>
>The Problem:
>Under the two conditions specified (prg and exe), no report will be run if a date range is entered. When viewing the data session, an error occurs: "Variable ldEndDate Not Found". The original tables are from FoxPro DOS 2.5, and placed in a VFP 6.0 DBC. The format is 01/01/1999, and a date field is used. The grid on the report form indicates 01/01/99, and behaves correctly. It is when you go to run the report that you can see the report window pop up and says "printing 3 pages", and disappears. With the debugger on, it dies at the read events statement. This is something simple, but I have not discovered the answer, yet. About three dozen forms run correctly, as the date is not used, and now I am almost ready to deliver the finished application, except for this date problem. Any ideas or suggestions?
>
>The code below runs as a form:
>
>Init of form
>
>* Initilize values and set focus…
>With ThisForm
> .cntDateRange.txtBeginDate.Value = {}
> .cntDateRange.txtEndDate.Value = {}
> .cntDateRange.txtBeginDate.SetFocus()
>EndWith
>
>zSearch()
>* User has selected the search command button…
>* Set the grid RecordSource to SPACE(0)...
>ThisForm.grd.RecordSource = SPACE(0)
>
>LOCAL ldBeginDate,ldEndDate,lcProduct,lcStatus,lcTech, lcFilter
>lcTech = ""
>lcFilter = ""
>ldBeginDate = ThisForm.cntDateRange.txtBeginDate.Value
>ldEndDate = ThisForm.cntDateRange.txtEndDate.Value
>
>IF NOT EMPTY(ldBeginDate)
> lcFilter = lcFilter + ;
> "Equ_Schd.Next_Date >= ldBeginDate AND "
>ENDIF
>
>IF NOT EMPTY(ldEndDate)
> lcFilter = lcFilter + ;
> "Equ_Schd.Next_Date <= ldEndDate AND "
>ENDIF
>
>* Build a filter…
>IF NOT EMPTY (lcFilter)
> lcFilter = "WHERE " + LEFT(lcFilter,LEN(lcFilter)-5)
>ENDIF
>
>SELECT * ;
> FROM Equ_Schd ;
> &lcFilter ;
> INTO CURSOR cuSked ;
> ORDER BY Next_Date
>
>* Were any records found...
>IF _TALLY > 0
> With ThisForm
> .grd.RecordSource = "cuSked"
> .grd.column1.ControlSource = "cuSked.Eqs_ID"
> .grd.column2.ControlSource = "cuSked.Sched_Main"
> .grd.column3.ControlSource = "cuSked.Next_Date"
> .grd.column4.ControlSource = "cuSked.Eqs_Issued"
> .grd.column5.ControlSource = "cuSked.Eqs_Type"
> .grd.column6.ControlSource = "cuSked.Notes"
> .cntReportSearch.cmdReport.Enabled = .T.
>* Report Form SlSked Preview && The report runs at this point in the exe
> EndWith
>ELSE
> =MESSAGEBOX("No matching records found. Try again?",48,"No Match")
> ThisForm.cntDateRange.txtBeginDate.SetFocus()
>ENDIF
>
>
>
>
>zReport()
>*Report method…
>DO CASE
>* View report on screen...
> CASE ThisForm.cntOutput3.opgOutput.Value = 1
>
> REPORT FORM SlSked PREVIEW
>* Print the report...
> CASE ThisForm.cntOutput3.opgOutput.Value = 2
> REPORT FORM SlSked TO PRINTER PROMPT NOCONSOLE
>*PROMPT
>* Create a file from report...
> CASE ThisForm.cntOutput3.opgOutput.Value = 3
> GetDir()
>SELECT cuSked COPY TO (substr(ThisForm.zCursorName,3)) + ".txt" DELIMITED
>ENDCASE
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform