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

    Angry Unanswered: IF statement - for discount calculation.

    Hi,

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

    Code:
    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
          .MoveNext
       End Do
    End With
    The error I get is Type Mismatch

    Would appreciate if someone could Help!!!

    Rgds

  2. #2
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    "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
    Location
    The Bottom of The Barrel
    Posts
    6,102
    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
  •