By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,215 Members | 1,372 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,215 IT Pros & Developers. It's quick & easy.

How to return a value if results equal a number?

P: 17
i am new to the VBA world.

I am using a option group to give the user checkboxes.

1 = Blue
2 = Red
3 = Black
4 = Green

However using the option group it only stores the values as numbers.
I am creating a report, i cannot place the optikon group on the report because the user wants to see it as a word not a checkbox.
So i am trying to place on the report, if value =1 display the word "Blue", but i don't know how to do.

Please help!
Jan 23 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 2.5K+
P: 3,532
One way would be to not bind the Option Group to the field in the underlying table, but to assign a value to the field depending on which checkbox is selected. In the example I called the field in the table Hue. Replace its name and the name of the frame holding your Option Group with your own actual names:
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourFrameName_Click()
  3. Select Case YourFrameName
  5. Case 1
  6. Me.Hue = "Blue"
  8. Case 2
  9. Me.Hue = "Red"
  11. Case 3
  12. Me.Hue = "Black"
  14. Case 
  15.  Me.Hue = "Green"
  17. End Select
  18. End Sub
Welcome to TheScripts!

Linq ;0)>
Jan 23 '08 #2

P: 17
Thanks Linq, it worked like a charm, this is my new standard now.
Jan 29 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.