OK, OK,,,
I'm the buggy one
I found the problem, the list vm_comp variable had to
be fed in as a literal... OH, this is so painful..
PRINT emplbycomp +
WHERE company IN (&vm_comp) +
AND injurydate BETWEEN .vmdt_begdt AND .vmdt_enddt +
ORDER BY company ASC, injurydate DESC, lname +
ASC, fname ASC
But, I'm glad it works... Thanks Anyway.
Jim Limburg
Jim Limburg wrote:
>
> G-Day all
>
> This one is driving me nuts...
>
> I am using RBase 6.5++ version 1.842xRT03
>
> I can run a report using the Where builder that returns this:
>
> WHERE Injuries.Company IN (tmd,palm,tech) AND
> Injuries.InjuryDate BETWEEN 01/01/99 AND 12/31/01
> ORDER BY Injuries.Company ASC, Injuries.InjuryDate DESC
>
> and the report runs fine.. but when I am USING the following Code:
>
> SET VAR vmtxt_begdt TEXT = NULL
> SET VAR vmdt_begdt DATE = NULL
> DIALOG 'Enter a begining date' vmtxt_begdt=10 vm_key1 1 AT 15 19
> SET VAR vmdt_begdt DATE = .vmtxt_begdt
> IF vm_key1 <> '[Esc]' THEN
> SET VAR vmtxt_enddt TEXT = NULL
> SET VAR vmdt_enddt DATE = NULL
> DIALOG 'Enter an Ending date' vmtxt_enddt=10 vm_key2 1 AT 15 19
> SET VAR vmdt_enddt DATE = .vmtxt_enddt
> IF vm_key2 <> '[Esc]' THEN
> IF vmdt_begdt IS NOT NULL AND vmdt_enddt IS NOT NULL THEN
> CHOOSE prnorscr FROM menuprnscr IN wrkinjry.apx
> IF prnorscr = 'Printer' THEN
> SET LINES 79
> CLEAR VAR prnorscr
> OUTPUT PRINTER
> ELSE
> SET LINES 24
> CLEAR VAR prnorscr
> OUTPUT SCREEN
> ENDIF
> SET VAR vm_statement = +
> 'PRINT emplbycomp WHERE company IN (' + .vm_comp + +
> ') AND injurydate BETWEEN ' + .vmdt_begdt + ' AND ' + .vmdt_enddt
> + +
> ' ORDER BY company ASC, injurydate DESC'
> &vm_statement
> IF errvar <> 0 THEN
> OUTPUT SCREEN
> PAUSE FOR 3 USING 'No matching Items Found' AT CENTER CENTER
> ENDIF
> ***** PRINT emplbycomp +
> WHERE company IN (.vm_comp) AND injurydate BETWEEN .vmdt_begdt +
> AND .vmdt_enddt ORDER BY company ASC, injurydate DESC
> IF errvar <> 0 THEN
> OUTPUT SCREEN
> PAUSE FOR 3 USING 'No matching Items Found' AT CENTER CENTER
> ENDIF
> OUTPUT SCREEN
> ENDIF
> ENDIF
> ENDIF
>
> the variable vm_statement executes just fine... but the following
> PRINT statement (where the ***** is) which is identical returns that
> No rows exist to satisfy clause.
>
> I built the vm_statement statement to see what was going on, and it
> works fine. The ***** Print statement here should work.. I am not seeing
> any reason for it not to work.
>
> Has anyone seen similar results?
>
> Jim Limburg