Results 1 to 3 of 3
  1. #1
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862

    Selecting Field VBA

    Field Name.............Field Default Value.............Priority of Fill


    AO_Vote.................Null...................... ...........1
    O6_Vote.................Null...................... ...........2
    GO_Vote.................Null...................... ...........3
    Final_Vote...............Null..................... ...........4

    Code: AO_Votes: =IIf(Not IsNull([Final_Vote]),[Final_Vote],(IIf(Not IsNull([GO_Vote]),[GO_Vote],(IIf(Not IsNull([O6_Vote]),[O6_Vote],[AO_Vote])))))

    Final_Vote must have AO_Vote, and O6_Vote

    Level 1:
    AO_Vote <>Null for Final_Vote to be filled in

    Level 2 and Level 3 Cat 1:
    AO_Vote <> Null for O6_Vote to be filled in. AO_Vote and O6_Vote <> Null for Final_Vote to be filled in.

    Level 3 Cat 2:
    AO_Vote <> Null for O6_Vote to be filled in. AO_Vote and O6_Vote <> Null for GO_Vote to be filled in. AO_Vote and O6_Vote and GO_Vote <> Null for Final_Vote to be filled in.

    With the above code I want the highest filled field value to be the true statement.

    Level 1
    AO_Vote = "Deny"
    Final Vote = Deny True = "Deny"

    Level 2 and level 3 Cat 1
    AO_Vote = "Deny" and O6_Vote = "Approve"
    Final_Vote = Approve True = "Approve"

    Level 3 Cat 2
    AO_Vote = "Deny" and O6_Vote = "Approve" and GO_Vote = "Denied"
    Final_Vote="Denied" True="Denied"

    Its a heiarchal voting system AO is the little guy for the simple stuff. O6 outvotes AO and is for the higher level stuff. GO outvotes O6 for the high priority stuff. Whever the level is, is when Final Vote can be filled in.

    I am using the following SQL in a query.

    Code:
    TRANSFORM Count([CR_ID])-1 AS R_ID
    SELECT Chng_ReqQry.Level, Count([Level])-5 AS [HB Totals]
    FROM Chng_ReqQry
    WHERE (((Chng_ReqQry.Sub_No)=0) AND ((Chng_ReqQry.Date_Closed) Between Date()-7 And Now()))
    GROUP BY Chng_ReqQry.Level
    PIVOT Chng_ReqQry.AO_Votes;
    I cannot get "Withdrawn" amount to show up in the count. the actual field value is:
    AO_Vote = "Withdraw"
    O6_Vote = "Withdraw"
    GO_Vote = Null
    Final_Vote = "Withdrawn"

  2. #2
    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,849
    I think you are confusing readers (me for sure) with your Level 2 and level 3 Cat 1 etc.

    Can you try your explanation in simpler terms, or example?

  3. #3
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862
    Its convoluted. The level sets the requirements. Lowest needs 1 field filled in to allow Final_vote to be populated. The next level needs 2 fields filled in, with highest level needing 3 fields filled in. It is sequential.

    So I am trying to code that backwards. If the Final_Vote field is filled in then it displays that first. If Final_Vote is Null then it checks the GO_Vote field. If GO_Vote is Null then it checks the O6_Vote and so on. Where it is not Null that is what it displays.

    The Query:
    Click image for larger version. 

Name:	QRY.png 
Views:	9 
Size:	20.2 KB 
ID:	19955


    The Outcome:

    Click image for larger version. 

Name:	Outcome.png 
Views:	9 
Size:	8.7 KB 
ID:	19956

    If you look at the software level - The total amount is correct - 5. The other fields have a 3 and a 1 total, I am missing the one where it is in Withdrawn. That should be comming from the Final_Vote Field.

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

Similar Threads

  1. Selecting TOP 3 in one field is not working properly
    By Access_Novice in forum Queries
    Replies: 5
    Last Post: 12-27-2014, 07:34 PM
  2. Selecting a field automatically selects the label
    By Access_Novice in forum Forms
    Replies: 1
    Last Post: 09-26-2013, 06:02 PM
  3. Selecting a few words from a field to display
    By bryant03 in forum Queries
    Replies: 1
    Last Post: 06-07-2012, 08:55 AM
  4. Replies: 3
    Last Post: 02-02-2012, 09:48 AM
  5. Selecting a corresponding table field based on text field.
    By michaeljohnh in forum Programming
    Replies: 5
    Last Post: 10-08-2010, 10:33 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