Results 1 to 12 of 12
  1. #1
    Bentley is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2016
    Posts
    50

    Storing Values from an Option Group

    Hello,



    I am having difficulties with a report from option labels. I created the set of option labels and the values is being stored in the table, and when I make the report, the value for that is displayed instead of the name which is what I need. Any suggestions as to what I am missing?

    thanks,

    Bentley

  2. #2
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Possibly the sql/query behind the report does not reference the desired field and/or the report control you expect to see the desired value in is linked to the wrong table/query/sql field. You'd have to provide more info if that doesn't help. We'd need to know where the "name" field is and probably info on the report design, including the sql behind it.
    You are assigning the chosen value button (not label, right?) to a frame to ensure you get the right number?
    Last edited by Micron; 07-05-2016 at 01:20 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Bentley is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2016
    Posts
    50
    I do not have any sqp/query behind this. I created the option box to select the building code required. This info is stored in a WO table, and yes, it is assigning the value not the text label. I would like to see the text reported as the number value isn't meaningful on a report.

    I am very green when it comes to access, and I appreciate any and all help.

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    An option group only has a numeric value, corresponding to the value assigned to the selected option. You would need another table to decode that value into the corresponding text. You can't determine the caption in the option label with VBA.

  5. #5
    Bentley is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2016
    Posts
    50
    Thanks. I was hoping there was an easy way to get this info.

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    If, for instance, your Labels in the Option Group were

    Dog
    Cat
    Cow


    in that order, on your Report have an Unbound Control and use this as the Control Source:

    Code:
    =IIf([AnimalType]=1,"Dog",IIf([AnimalType]=2,"Cat", IIf([AnimalType]=3,"Cow","")))


    Notice that the final argument of the last IIF() is a Zero-Length String {""}, and that the number of Closing Parens {)))} must be equal to the number of IIFs used.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  7. #7
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Or if the table has a field that contains a text value that's associated with the numeric field you're storing, you get it via a query and base the report on a query that encompasses all the fields and records you need rather than basing your report on a table. I wrongly made the assumption that the report was based on a query or sql statement because reports are generally not based on entire tables - rather combinations and/or subsets of them. Those subsets are created using queries.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    Bentley is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2016
    Posts
    50
    Thanks missinlinq. The only step I can't get is the link between the form labels and the record. I keep getting an enter parameter when I run the form. I have the control source looking up the stored value with the code you provided. This is probably too advanced for me at this time.

    Ben

  9. #9
    Bentley is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2016
    Posts
    50
    I meant when I run the report not form. My mistake.

  10. #10
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by Bentley View Post
    ...The only step I can't get is the link between the form labels and the record.
    Sorry, but I have no idea what you man by the above! You simply have to tell Access what text you want to appear for each Value from the Option Group...i.e. where I have 'dog,' 'cat' and 'cow' you need to supply whatever text you want to appear on the Report. There is no way (that I know) to do this automatically.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Bentley,

    Do a compact and repair of your database; then create a zip file and post it so we can see what you are working with.
    As 'Linq said, we're not following/understanding your post.

  12. #12
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    The only step I can't get is the link between the form labels and the record
    The only way to change report labels (or form labels) dynamically is to use VBA, something like:

    me![labelname].caption = ...(some value), where the value is calculated from some report data. for a report, you would probably put it in the On Format event of the detail section.

    I keep getting an enter parameter when I run the form (report)
    That usually happens when a query contains a field reference it cannot understand, either in an expression for a column value, or a criteria expression.

    What is the record source for your report?

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

Similar Threads

  1. Use Option Group to Filter Combo Box Values
    By dgj32784 in forum Programming
    Replies: 2
    Last Post: 06-06-2011, 12:04 PM
  2. Resetting Option Group Values
    By oleBucky in forum Forms
    Replies: 4
    Last Post: 03-31-2011, 05:19 PM
  3. option group default values
    By wlumpkin in forum Access
    Replies: 3
    Last Post: 02-15-2011, 03:30 PM
  4. option group default values
    By wlumpkin in forum Access
    Replies: 6
    Last Post: 02-07-2011, 06:07 PM
  5. Combo Box and Option Group Values
    By Desstro in forum Queries
    Replies: 8
    Last Post: 09-06-2010, 11:40 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