Results 1 to 7 of 7
  1. #1
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46

    Combining Conditions Help

    I am making changes to an existing Database. One of the requirements is to have 2 conditions that work together.


    Either condition by its self works great, but when I try to combine them the database only recognizes the condition written first and not the second. I have tried both ways.

    Below is the code that I have written.

    1. [CODE]If CH_dm = 0 Then
    ADQ2_Complete_Date.Enabled = False
    Else
    ADQ2_Complete_Date.Enabled = True
    End If
    [/CODE]

    2.[CODE]If Communication_Type.Value = "MarketingCampaign" Then
    ADQ2_Complete_Date.Enabled = True
    Else
    ADQ2_Complete_Date.Enabled = False
    End If
    [/CODE]

    Thanks for any help

    Holli

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Where have you placed this code? Is it found in a certain event? We need to know exactly what is calling or triggering this code.

    What happens when these two things are in conflict, i.e. what if CH_dm=0 (which says to Disable) and Communication_Type = "MarketingCampaign" (which says Enable)? What is the hierarchy? Which condition wins any conflicts?

  3. #3
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46
    The code is placed in the Form Current .
    If you select Direct Mail Yes/No Box and the Communication Type "Marketing Campaign" drop down
    then ADQ textbox will open. If you don't make this selection the ADQ Textbox should stay closed.

    Right now it will stay closed with either code alone. But I need the code to work together. So if Direct Mail and Marketing Campaign are not selected the ADQ Textbox will stay closed.

    Thanks

    Holli

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Try:
    Code:
    If (CH_dm <> 0) And (Communication_Type.Value = "MarketingCampaign") Then
        ADQ2_Complete_Date.Enabled = True
    Else
        ADQ2_Complete_Date.Enabled = False
    End If

  5. #5
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46
    Yes Thank you so much.

    I have one more question. What if I need to add and OR where should I place it?

    Again thanks

    Holli

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    It all depends on the order/precedence of your conditions, but that would go an IF line also (either the same one we have, or a nested IF statement, if necessary).

  7. #7
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46
    Everything is working

    Thanks again!!!

    Holli

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Top 5 per several conditions
    By tmcrouse in forum Queries
    Replies: 4
    Last Post: 03-11-2015, 07:52 AM
  2. iif for 16 conditions
    By harpreett.singhh@gmail.co in forum Access
    Replies: 3
    Last Post: 05-26-2014, 04:50 PM
  3. Replies: 14
    Last Post: 07-22-2013, 12:39 PM
  4. if...then conditions ???
    By em07189 in forum Access
    Replies: 6
    Last Post: 03-05-2010, 10:29 PM
  5. Conditions / Expressions
    By Mark344 in forum Access
    Replies: 1
    Last Post: 02-19-2010, 08:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums