Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Type Mismatch
#1
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)
Reply
#2
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.
Reply
#3
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
Reply
#4
(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
Reply
#5
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
Reply
#6
Moneo:  Nicely solved!
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)