Results 1 to 5 of 5

Thread: Quick Question?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Fremont Ohio 43420
    Posts
    253

    Question

    Hi

    I have this formula that is suppose to look at two fields and determine if both are under the value, if the values are under the other value then it should write MFG DEFECT in the txtfields(8).

    If Val(txtFields(5).Text) < 7.2 And Val(txtFields(7).Text) < Val(txtFields(4).Text) Then
    txtFields(8) = "MFG DEFECT"
    End If

    It does not do that though, actually it doesn't do anything. I was wondering if someone could help me out with this?

    Thanks

    jeffro

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Add another set of parenthesis'

    Code:
    If Val(txtFields(5).Text) < 7.2 And (Val(txtFields(7).Text) < Val(txtFields(4).Text)) Then 
           txtFields(8) = "MFG DEFECT" 
    End If
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Fremont Ohio 43420
    Posts
    253
    No that didn't help either, nice try though!

    jeffro

  4. #4
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    400
    Ok, add the following line, and if the problem doesn't become obvious, post the results of the immediate window back here and I'll take a look.
    Code:
    Debug.Print "If " & Val(txtFields(5).Text) & " < 7.2 And " & Val(txtFields(7).Text) & " < " & Val(txtFields(4).Text) & " Then"
    If Val(txtFields(5).Text) < 7.2 And Val(txtFields(7).Text) < Val(txtFields(4).Text) Then 
        txtFields(8) = "MFG DEFECT" 
    End If

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Fremont Ohio 43420
    Posts
    253
    jmcswain,

    I have all this in the lost focus event:

    If Val(txtFields(5).Text) < 7.2 Then
    txtFields(8).Text = "CCA"
    Else
    If Val(txtFields(7).Text) < Val(txtFields(4).Text) Then
    txtFields(8) = "RCT"
    Else
    If Val(txtFields(5).Text) < 7.2 And (Val(txtFields(7).Text) < Val(txtFields(4).Text)) Then
    txtFields(8) = "MFG DEFECT"
    End If
    End If
    End If

    If Val(txtFields(5).Text) > 7.2 Then
    txtFields(8).Text = ""
    Else
    If Val(txtFields(7).Text) > Val(txtFields(4).Text) Then
    txtFields(8) = ""
    End If
    End If

    My code seem to be working fine and now it is not work correctly at all. I'm having problems with getting the right (CCA, RCT, MFGDEFECT) to show up. Can you help me out, please?

    thanks alot jeffro

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