Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Trouble with InputBox (Acc 97 sr2 on 95b)

    I am trying to do the following:

    Dim infostr, jobprice
    Dim QCOST
    QCOST = "1"
    [QJobNo] = inputbox("New Job Number", "Quote Form") ' this line is fine
    jobprice = inputbox("Enter the Job Cost - $" & [QPrice], , QCOST, "Quote Form")

    If I do this:

    jobprice = inputbox("Enter the Job Cost - $" & [QPrice], "Quote Form")

    Not a problem, but if I do this:

    jobprice = inputbox("Enter the Job Cost - $" & [QPrice], , QCOST, "Quote Form")

    then I get: Err 13 Type mismatch error.
    I cannot see why this will not work.

    I had been trying :

    QCOST = str([QPrice])

    where [QPrice] was a Number variable and was getting the error, so I changed it to one of the help examples and still can't get it to work!

    Any ideas?
    "Heading for the deep end"

  2. #2
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Trouble with InputBox (Acc 97 sr2 on 95b)

    It looks like you have 1 comma too many which makes "Quote Form" the 4th argument, which for InputBox function is xpos, a numerical value for horizontal screen position. That's why you're getting a type mismatch error. I think what you want is something like:
    <pre>jobprice = InputBox("Enter the Job Cost - $" & [QPrice], "Quote Form", QCOST)</pre>

    I switched the 2nd two arguments because it looks like "Quote Form" should be the title which is 2nd argument, while QCOST is supposed to be the default response (I think) which is 3rd argument. If you declared your variables as specific data types it'd be easier to keep track of what's going on & avoid type mismatch errors.

  3. #3
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Trouble with InputBox (Acc 97 sr2 on 95b)

    Many thanks Mark and I am going to start declaring variables from now on also.

    Being virtually self taught, I have established a lot of bad habits that I need to correct, this being one of them.
    "Heading for the deep end"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •