Visual Basic Help

  Charence 20:03 26 Dec 04

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,


  VoG II 20:11 26 Dec 04

Something missing in this line?

If Val(CurrentQty) Val(RestockQty) Then

<, > , = etc ?

  Charence 20:12 26 Dec 04

oh its meant to have <

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

Thanks, Charence

  Charence 20:18 26 Dec 04

it keeps saying

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


  VoG II 20:21 26 Dec 04

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


Shouldn't you be converting RequiredQty into a string?

  Charence 20:26 26 Dec 04

ok I'll try that

  Charence 20:28 26 Dec 04

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

Thank you,


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

How to watch Windows Event live stream, live blog | Microsoft event live stream: Watch Microsoft…

1995-2015: How technology has changed the world in 20 years

This amazing app turns your iPad Pro into a Cintiq

iPhone 7 Plus review: A superb big-screen phablet, but the price tag's enormous | iPhone 7 Plus…