• Trouble with InputBox (Acc 97 sr2 on 95b)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Trouble with InputBox (Acc 97 sr2 on 95b)

    Author
    Topic
    #367838

    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?

    Viewing 0 reply threads
    Author
    Replies
    • #574834

      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:

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

      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.

      • #574847

        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.

    Viewing 0 reply threads
    Reply To: Trouble with InputBox (Acc 97 sr2 on 95b)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: