Results 1 to 3 of 3
  1. #1
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176

    Question Giving a checkbox a value (to export and use for calclations)


    So I've been working on this big project and part of it is to be able to input data into a form that looks just like the one everyone is using currently.
    The thing is that the form is made up of mostly checkboxes:
    Click image for larger version. 

Name:	Capture4.PNG 
Views:	5 
Size:	17.3 KB 
ID:	12809

    Eventually I want to be able to do some calulations with this data. The check boxes at Yes/No check boxes which works for the Satisfactory/Unsatisfactory part but I was wondering if I could assign a value to it (ex: 5).

    I was thinking of different ways to go about this and was thinking along the lines of using the count function to get some data.

    I read on the microsoft page about changing the countrol source with IIF([<fieldname>]=True,"","5"). What is/How do I get to the control source? Would I have to use Yes instead of True because I use yes/no boxes?

    If this works to import it into excel or something that would work just as fine too.

    Thanks!
    Last edited by offie; 06-20-2013 at 11:29 AM.

  2. #2
    Privateer is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Location
    Stamford, CT
    Posts
    1
    Create a query with this table as the source. Put all the fields in the query. Now put the cursor in the column after the last field. This is where the immediate IF statement goes. You alias the field name and enter a value if the field was checked off.

    If you want one field with the checked off value, use the line below. I am assuming that only one check box can be selected per row.
    Rating: IIF([Box5]=True,5,iif(Box4=true,4,iif(box3=true,3,iif(box2=t rue,2,1)

    If you want five columns with a value in each, the answer is below. You test the field for a true or false value, give it a number, and alias the field name with the AS ???

    SELECT tblRating.Question, IIf([Great]=True,5,0) AS GreatValue, IIf([Good]=True,4,0) AS GoodValue, IIf([Average]=True,3,0) AS AverageValue, IIf([Bad]=True,2,0) AS BadValue, IIf([Horrible]=True,1,0) AS HorribleValue
    FROM tblRating;

    Hope that helps.
    Privateer

  3. #3
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    Thanks! Works great.

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

Similar Threads

  1. Search Query not giving all results
    By wrkadri in forum Queries
    Replies: 5
    Last Post: 02-05-2013, 12:37 AM
  2. How to group by giving levels
    By mdnikki in forum Queries
    Replies: 8
    Last Post: 10-08-2012, 09:08 AM
  3. DCount on a Query giving #Name? error
    By Huddle in forum Access
    Replies: 9
    Last Post: 06-20-2012, 11:40 AM
  4. Title: Giving Wrong Name
    By netchie in forum Forms
    Replies: 5
    Last Post: 09-15-2011, 10:53 AM
  5. NoData() still giving me an error.
    By cowboy in forum Programming
    Replies: 3
    Last Post: 04-08-2010, 12:26 PM

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