Results 1 to 10 of 10
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Conflicting conditions (Access 2000)

    Edited by HansV to fix broken lines of code

    Conlficting conditions

    In my OnCurrent event i have 2 codes for disabling the controls with 2 conditions :
    TurnDown = True
    MyCustomer = True
    The conditions TurnDown and MyCustomer are attained with the Yes/No control.
    If i put the two codes together,one of them doesnt work.For example if the first condition
    TurnDwon is True, then the second condition MyCustomer doesnt work.
    Twe 2 codes work fine separately, but when put together in the OnCurrent event,only one of them
    works and the other not. How can i avoid this ?

    Dim c As Control
    Dim ctr As Control
    If Me![TurnDown] = True Then
    For Each c In Me.Controls
    If c.Tag = "Hide" Then c.Enabled = False
    Next c
    Else
    For Each c In Me.Controls
    If c.Tag = "Hide" Then c.Enabled = True
    Next c
    End If

    If Me!MyCustomer = True Then
    For Each ctr In Me.Controls
    If ctr.Tag = "Hide" Then ctr.Enabled = False

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Conflicting conditions (Access 2000)

    You will have to tell us what you want to do for each combination of TurnDown and MyCustomer.
    - What if TurnDown = True and MyCustomer = True?
    - What if TurnDown = True and MyCustomer = False?
    - What if TurnDown = False and MyCustomer = True?
    - What if TurnDown = False and MyCustomer = False?

  3. #3
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conflicting conditions (Access 2000)

    Thank you very much for your reply.
    We have the following three alternatives:

    1. TurnDown= False and MyCustomer = False. It means nothing has happened with the client.
    2. TurnDown = False
    3. MyCustomer = False

    TurnDown = False and MyCustomer = False is not possible.The client has either turdned down or become a customer.

    TurnDown = True and MyCustomer = True is also not possible, for the same reasons

    Thank you for the efforts you have done and also thank you in advance for the solution you may propose

    regards

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Conflicting conditions (Access 2000)

    It seems that TurnDown is exactly the opposite of MyCustomer: if one is True, the other is False and vice versa. That means that you don't need both fields/controls: if you know the value of one ot them, you know the value of the other too. This will also simplify your code: you only need to check for the field/control you keep.

  5. #5
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conflicting conditions (Access 2000)

    Thank you very much for your reply.There is also a third alternative whene both MyCustomer and TurnDown are false,and this possibility cannot be expressed with one field/control only.Actually this status is the most frequent one, when neither of the controls are ticked.
    Can i combine all that into one code?


    regards

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Conflicting conditions (Access 2000)

    I'm confused: higher up in this thread you wrote
    <hr>TurnDown = False and MyCustomer = False is not possible.<hr>
    and now you say this is the most frequent status. So I return to my original question: please explain exactlywhat should be enabled/disabled in each of the possible situations.

  7. #7
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conflicting conditions (Access 2000)

    I am really sorry i have confused you indeed. Please forgive my stupidity.I have corrected things now.
    Actually i have three alternatives only

    1. TurnDown= False and MyCustomer = False.
    2. TurnDown = True
    3. MyCustomer = True


    So to your questions, my answers are answers

    - What if TurnDown = True and MyCustomer = True? it is not possible
    What if TurnDown = True and MyCustomer = False? second alternative
    - What if TurnDown = False and MyCustomer = True? third alternative
    What if TurnDown = False and MyCustomer = False? first alternative


    Please forgive me for my oversight.I think i have given you the right alternatives now.

    Best regards

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Conflicting conditions (Access 2000)

    Please try to be specific. I don't know what "second alternative" etc. are.

  9. #9
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conflicting conditions (Access 2000)

    Thank you for your reply.

    I want to disable controls when :
    1. TurnDown = True
    2. MyCustomer = True

    I do not want to combine the above possibilities under one control Yes/No since there is a third possibility,neither TurnDown or MyCustomer,
    which cannot be expressed by onw control only.
    I want to enable controls when
    TurnDown= False and MyCustomer = False.

    When TurnDown = True i want to disable specific controls and when MyCustomer= True
    i also want to disable also specific controls.

    Best regards

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Conflicting conditions (Access 2000)

    You're stll not very specific, so I can give only a general idea:

    If Me.TurnDown = True And Me.MyCustomer = False Then
    ' Enable/disable specific controls here
    ElseIf Me.TurnDown = False And Me.MyCustomer = True Then
    ' Enable/disable specific controls here
    Else ' this must be Me.TurnDown = False And Me.MyCustomer = False
    ' Enable/disable specific controls here
    End If

    You will have to fill in the details yourself.

Posting Permissions

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