Hello,
Below is how to do this with just one report. It can be expanded to include several reports. The code was written in the sample file Customers.db, so you will need to change the Form, Report, and Element names accordingly.
You will want to add a command button to your form. In it's on element entry event goes the following code.
Var vDate as Date
Var vWord as String
Var vSuccess as Int
vDate = @Calendar(@Date, "Please choose a Date")
vWord = @PromptForUserInput("Please type in a Hobby", "Tennis")
GlobalValue("RunReport", "1")
GlobalValue("ReportDate", @Str(vDate))
GlobalValue("ReportWord", vWord)
vSuccess = @SelectTreeItem("Search Update Menu!Search (F7)")
In your Forms on Retrieve Spec open event goes the following code. Since your third element is on a subform you will have to use FormFieldValue() to fill it in at the retrieve spec. The Date element must be filled in with FormFieldValue() so that the ">" and ";=" are inserted in the element.
Var vSuccess as Int
If @ToNumber(@GlobalValue("RunReport")) = 1 Then
{
FormFieldValue("Main Form", "Date_Entered", 0, ">" + @GlobalValue("ReportDate") + ";=")
Company = "="
Hobbies = @GlobalValue("ReportWord")
vSuccess = @SelectTreeItem("Search Menu!Search Commands!Retrieve New Results (F10)")
}
In your Form's On Form Entry event goes the follwoing code
Var vSuccess as Int
If @ToNumber(@GlobalValue("RunReport")) = 1 Then
{
vSuccess = @SelectTreeItem("Search Update Menu!Results Commands!Reports!Customers!Simple Report (Preview)")
GlobalValue("RunReport", "0")
GlobalValue("ReportDate", "")
GlobalValue("ReportWord", "")
}
If you would like a sample of this implemented send an e-mail to support@Lantica.com and ask RunReportPromptForCriteria.db
-Ray