Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004

    Angry Unanswered: IF statement - for discount calculation.


    I have the following table

    FieldNames: Sign1, Val1, Sign2, Val2, Discount

    Record1: >=, 0, <=, 1, 0.05
    Record2: >, 1, <=, 2, 0.10
    Record3: >, 2, >, 2, 0.15

    (Record3 is filled so to avoid null value in Val1)

    ...The following code doesn't work...

    Dim Ratio, Dscnt As Single
    With recordset    'recordset points to the tbl above 
       Do Until .EOF
          If Ratio & !Sign1 & !Val1 & " And " & !Sign2 & !Val2 Then
             Dscnt = !Discount
             Exit Do
          End If
       End Do
    End With
    The error I get is Type Mismatch

    Would appreciate if someone could Help!!!


  2. #2
    Join Date
    Apr 2004
    Kingsland, Georgia
    "Pick a number from 1 to 10." "Goat!" that's a Type Mismatch. it means you're trying to assign a value of one type to a value of a different type. check your datatype for your fields in the database. i'm guessing that your Discount field doesn't have the Field Size set to Single in your database table, but you didn't say which line the error occurs on. good luck.
    Last edited by jmahaffie; 04-26-04 at 13:49.

  3. #3
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    To be more specific, your Sign variables will not be interpreted as operators.

Posting Permissions

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