Results 1 to 2 of 2
  1. #1
    shabbaranks is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Posts
    162

    Trying to use an IF statement with an AND - is this possible?

    Hey guys,



    Im trying to create a form which holds a list of departments. The user selects a department and if they are a member of that department and in a managers group then run a query which selects users from a table excluding themselves.

    I have added the groups, I have added a column to the users table which holds thier group membership and now I am starting (trying to code). But Im not entierly sure how to go about it. I would need to use an IF sUser and groupID = me.departmentcombo.columnx

    column x matching the groupid of sUser?

    Thanks

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    I just ran this If statement in Access 2010. I think it will work in any version, though.

    Code:
    Me.Order.SetFocus
    strOrder = Me.Order.Text
     
    Me.Customer_Name.SetFocus
    strCustomer = Me.Customer_Name.Text 
     
    If strOrder = "112" And strCustomer = "Johnny" Then
    MsgBox "Johnny - 112!!"
    End If
    I got the messagebox to pop up when I hit the row of data on the Form in which the Order Number was 112 and the Customer Name was Johnny.

    So - Yes - it IS possible.

    I hope this answers your question?

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

Similar Threads

  1. Replies: 7
    Last Post: 08-17-2011, 01:49 PM
  2. Help on an IIF statement
    By Madmax in forum Access
    Replies: 4
    Last Post: 06-23-2011, 12:02 PM
  3. If Statement
    By MFS in forum Programming
    Replies: 13
    Last Post: 06-16-2011, 08:54 PM
  4. If Statement Help
    By vennies83 in forum Queries
    Replies: 1
    Last Post: 06-09-2011, 03:50 PM
  5. IIf Statement...HELP!
    By bdhFS in forum Queries
    Replies: 5
    Last Post: 05-19-2010, 07:55 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