Results 1 to 4 of 4

Thread: REALLY need help!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Location
    Baytown, TX United States
    Posts
    19

    Post

    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

  2. #2
    Junior Member
    Join Date
    Oct 1999
    Posts
    16

    Post

    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).]

  3. #3
    New Member
    Join Date
    Nov 1999
    Posts
    6

    Post

    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?

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Location
    Baytown, TX United States
    Posts
    19

    Post

    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
  •  



Click Here to Expand Forum to Full Width