|
-
Nov 22nd, 1999, 05:42 AM
#1
Thread Starter
Junior Member
This code won't work! Anyone know what's wrong?
Dim curSales as Currency
curSales = Val(Inputbox("Enter a sales amount"))
do
curSales = Val(Inputbox("Enter a sales amount"))
Print curSales * .1
Loop Until curSales < = 0
-
Nov 22nd, 1999, 05:47 AM
#2
Junior Member
Constantly asking user (look out for those people) to change a variable you are working with And using as loop control.
i.e. if the user does not change curSales, your code leaves curSales = curSales and thus curSales will not be <=0
try again
[This message has been edited by Ice (edited 11-22-1999).]
-
Nov 22nd, 1999, 05:56 AM
#3
New Member
Can't tell you what's wrong without knowing what it's supposed to do.
However, here's what I'm assuming this code is supposed to do: ask the user for a sales amount, print what they entered (* .1) and keep doing that until the sales amount the user entered multiplied by .1 is <= 0 (which means if the user entered a 0 the loop should stop.
If this is the case, the code won't print the first amount entered by the user. Copying the print statement to right before the do statement would fix that.
Where are you trying to print the sales amounts to? The printer? Then use printer.print? Or perhaps the destination is a field on the form? I can't tell from your code snippet.
By the way, this isn't a great technique for user input. How does the user know how to stop the program from asking for more input?
-
Nov 22nd, 1999, 10:49 AM
#4
Thread Starter
Junior Member
Thanks for the advice! It's not an actual program. It's an exercise in the text we're using for my VB class. We have to identify what's wrong with it, but you told me. I believe that's right.
------------------
kazooie21
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|