Results 1 to 11 of 11
  1. #1
    Join Date
    Apr 2003
    Posts
    280

    Unanswered: Need compound coding help

    This is an Basic code I'm working on but I'm having problem with the compound coding. I need some help.

    (Row 3 or 6 has to be true) and (row 1 or 2 has to be true)

    if((row = 3 and (len(fields(mins).text) > 0 and len(fields(units).text) > 0)) xor
    (row = 6 and (len(fields(mins).text) > 0 and len(fields(units).text) > 0))) and _

    ((row = 1 and (len(fields(mins).text) > 0 and len(fields(units).text) > 0)) xor _(row = 2 and (len(fields(mins).text) > 0 and len(fields(units).text) > 0))) then
    fields("st1icd9").status = fldNotFilled fields("st2icd9").status = fldNotFilled
    end if

    I got it to work with only two lines of code for the compound but if I put two lines of code on both side of 'And' then I have a problem with it. Did I put the parenthesis in the wrong place or needed to add some more?

    thanks!

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    what are do you need to do exactly? Are you just checking for null?
    Code:
    If IsNull(fields(mins)) AND IsNull(fields(units)) AND row IN (3,6,1,2) Then
       fields("st1icd9").status = fldNotFilled 
       fields("st2icd9").status = fldNotFilled 
    End If
    Last edited by Teddy; 06-17-04 at 17:23.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Apr 2003
    Posts
    280
    yeah, but I forgot to put this in. This should go on top of the code on mines..

    if (val(fields("st1icd9").text) = 0 and val(fields("st2icd9").text) = 0) then

    I need to get both side of the "And" {after this code: (row = 6 and (len(fields(mins).text) > 0 and len(fields(units).text) > 0)))} condition to be true but I'm unable to do it.

  4. #4
    Join Date
    Apr 2003
    Posts
    280
    I can do it this way:

    If (row = 6 and (len(fields(mins).text) > 0 and len(fields(units).text) > 0)) and _

    (row = 1 and (len(fields(mins).text) > 0 and len(fields(units).text) > 0)) then....

    do something
    end if

    But if I add more to it, it don't work for some reason..

    PS. this is the Basic Script code. The beginnging to Visual Basic language.

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    If (row = 6 and (len(fields(mins).text) > 0 and len(fields(units).text) > 0)) and _

    (row = 1 and (len(fields(mins).text) > 0 and len(fields(units).text) > 0)) then....

    That's a logical impossibility.

    What is row?

    Also, you should really take this over to the VB forum, this is access specific. Don't know much beyond VBA here.
    Last edited by Teddy; 06-17-04 at 17:35.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  6. #6
    Join Date
    Apr 2003
    Posts
    280
    Row is define as an integer.
    Dim row as integer
    For row = 1 to 7

    'do something

    next for

  7. #7
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    If row is an integer, how is expected to contain two values at the same time?

    An integer CANNOT simultaneously be 6 and 1 at the same time, during the same evaluation, on the same iteration.

    Something is flawed....
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  8. #8
    Join Date
    Apr 2003
    Posts
    280
    lol to myself..I wasn't even thinking about that. slap self to the face..Thanks by the way..

  9. #9
    Join Date
    Apr 2003
    Posts
    280
    VBA and VB is similar language..

  10. #10
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    We're just lowly access programmers here my friend



    Hope it works out for you!!

  11. #11
    Join Date
    Apr 2003
    Posts
    280
    You should try VB and see how similar it is. I see access programmer is much greater because they have to work around things, where VB has offer the code already.

Posting Permissions

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