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

    Help Statement meeting 2 conditions

    Thanks for any help

    I am currently trying to make changes to an existing database. One of my task is to have the
    user form date box open and highlight only if 2 specific conditions are met.



    User selecting Communication Type dropdown box "Marketing Campaign" and checkbox Yes " Ch_dm"

    I have written the following code but it is not working correctly. The text box is now defaulting to "Marketing Campaign" and if you select
    Ch_dm or "Marketing Campaign" the Date box will open. The only thing that is working correctly is if don't select anything the date box stays grayed out.

    I can see the error but cant figure it out. Combining the two.

    If Ch_dm = 0 Then
    If Communication_Type = "Marketing Campaign" Then
    ADQ2_Complete_Date.Enabled = True
    Else
    ADQ2_Complete_Date.Enabled = False
    End If

    Holli

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Be sure to use the property: value

    ADQ2_Complete_Date.Enabled =Communication_Type = "Marketing Campaign" and Ch_dm.value

  3. #3
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46
    Thanks Ranman256

    I am confused. Property Value?

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Holli,

    Use code tags when listing your code. Highlight the vba, then click the # above the posting window.
    Also shpw all of the code involved.

    Code:
    If Ch_dm = 0 Then '<======This If is an orphan, no end if...
    If Communication_Type = "Marketing Campaign" 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
    Sorry Orange,

    This is the code involved. When I try to remove the If I receive and error message

    Code:
    If Ch_dm = 0 Then 
    If Communication_Type = "Marketing Campaign" Then
    ADQ2_Complete_Date.Enabled = True
    Else 
     ADQ2_Complete_Date.Enabled = False
    End If
    Thanks

    Holli

  6. #6
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46
    Thank you! Orange

    You saved me.

    I have been looking at this all night. crazy person

    Holli

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

Similar Threads

  1. iff statement with a few conditions
    By Eric2013 in forum Queries
    Replies: 2
    Last Post: 09-15-2014, 06:12 PM
  2. Replies: 5
    Last Post: 10-21-2013, 06:44 PM
  3. Replies: 1
    Last Post: 06-20-2012, 12:44 PM
  4. iif statement with multiple conditions
    By ragsgold in forum Queries
    Replies: 7
    Last Post: 08-24-2011, 05:38 PM
  5. Iff Statement Meeting 2 Conditions
    By newbie in forum Access
    Replies: 11
    Last Post: 06-11-2009, 11:59 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