Visual Basic Help

  Charence 20:03 26 Dec 2004
Locked

Hi there's a piece of code in my program which I cannot seem to make work, what have I done wrong?


CurrentQty, RestockQty, NormalQty, StockName already have values.
****

If Val(CurrentQty) Val(RestockQty) Then

RequiredQty = Val(NormalQty) - Val(CurrentQty)

txtShoppingList = txtShoppingList + Val(RequiredQty) + " of " + StockName + vbCrLf

End If

****

Many Thanks,


Charence

  VoG II 20:11 26 Dec 2004

Something missing in this line?

If Val(CurrentQty) Val(RestockQty) Then

<, > , = etc ?

  Charence 20:12 26 Dec 2004

oh its meant to have <

its there in the code, just didn't copy onto PCA.


Thanks, Charence

  Charence 20:18 26 Dec 2004

it keeps saying

Run Time Error 13, Type Mismatch and the problem seems to be caused by the "txtShoppingList..." row

Charence

  VoG II 20:21 26 Dec 2004

I'm not a VB coder (VBA in Excel only) but this looks odd

Val(RequiredQty)

Shouldn't you be converting RequiredQty into a string?

  Charence 20:26 26 Dec 2004

ok I'll try that

  Charence 20:28 26 Dec 2004

Thank you VoG™, I converted it Str(RequiredQty) and its working now.

Thank you,

Charence

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

AMD Radeon Adrenalin release date, new features, compatible graphics cards

Artist Pete Oswald on creating relatable characters & his new book

New iMac Pro release date, UK price & specs rumours

Idées cadeaux pour geeks et tech addicts