Posts: 17
Threads: 4
Joined: Aug 2005
I get a Type Mismatch Error at the following statement in my program. The output still prints without the last data = TQTY(K). Can anyone see why I am getting this error?
LPRINT SC$(K), ID$(K); "Â Â ";USING "####.##"; UCST(K);"Â Â "; TQTY(K)
Posts: 1,138
Threads: 211
Joined: Feb 2020
Is TQTY a function or an array in your code? It will help us if you post more of your code as the value of K could be the problem.
Posts: 17
Threads: 4
Joined: Aug 2005
Here is more of the Code. What do you think?
500 REM PRINT RESULTS FOR THIS CATEGORY
    LPRINT PN$, " ", CAT$
    LPRINT
        FOR K = 1 TO NOR
        LPRINT SC$(K), ID$(K); " "; USING "####.##"; UCST(K); "  "; TQTY(K)
        TCST = TCST + UCST(K) * TQTY(K)
        NEXT K
    LPRINT
Posts: 1,956
Threads: 65
Joined: Jun 2003
(12-07-2007, 09:45 PM)jelamb link Wrote:I get a Type Mismatch Error at the following statement in my program. The output still prints without the last data = TQTY(K). Can anyone see why I am getting this error?
LPRINT SC$(K), ID$(K); "Â Â ";USING "####.##"; UCST(K);"Â Â "; TQTY(K)
I tried your code. You're getting the error because you can't append non-numeric data to be printed after an LPRINT USING or a PRINT USING, like the "Â Â ".
If you need to also format TQTY(K) USING "####.##". Try the following:
LPRINT SC$(K), ID$(K); "Â "; USING "####.##"; UCST(K);
LPRINTÂ "Â Â ";
LPRINT USING "####.##"; TQTY(K)
Regards..... Moneo
Posts: 17
Threads: 4
Joined: Aug 2005
Thanks Moneo,
That worked nicely. I am using DOSPRN and thought it might have something to do with that program but evidently not.
Thanks again.....John
Posts: 544
Threads: 27
Joined: Jan 2005
Moneo:Â Nicely solved!
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.