If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
checkbox values
I would like to make the value of a checkbox that is in a value group display
a text valuer in a field rather than the typical numeric value of 1, 2, 3 and so on. Something on the order of if a certain box call it Monday is checked and access made its value a 1 then another field in my table will output a text value of Monday, rather then showing me the numeric value of 1. I hope this makes some kind of sense!! Thanks in advance!! Myron |
#2
|
|||
|
|||
checkbox values
An option group returns the number as you indicate. You will need to format
this later to display it as desired. For example, in a textbox in a report you may want Monday, Tuesday, etc to be displayed instead of the number. This could be done by using the following Control Source for the textbox. =WeekDayName([FieldName] + 1) Monday is 2, Tuesday is 3, etc. So, if your table has Monday stored as 1, add 1 to that to get 2. Another formatting option would be: =Choose([FieldName], "Monday", "Tuesday", "Wednesday") Add as many items as you need. -- Wayne Morgan MS Access MVP "Myron Mummey" wrote in message ... I would like to make the value of a checkbox that is in a value group display a text valuer in a field rather than the typical numeric value of 1, 2, 3 and so on. Something on the order of if a certain box call it Monday is checked and access made its value a 1 then another field in my table will output a text value of Monday, rather then showing me the numeric value of 1. I hope this makes some kind of sense!! Thanks in advance!! Myron |
#3
|
|||
|
|||
checkbox values
Myron,
An option group always has an integer value--this is inherent to the option group control. You can, of course, *display* more meaningful text by assigning text to the each button's label. If you need to display the text in a report or in the result of a query, you have the following options: - Use a nested IIf statement to calculate a field. Recommended for 2 or less choices, e.g., (=IIf([MyOptionGroup]=1,"Monday",IIf([MyOptionGroup]=2,"Tuesday",""),"") - Write a custom function to use in the calculation: Public Function MyText(intOptionGroupVal as Integer) As String Select Case intOptionGroupVal Case 1 MyText = "Monday" Case 2 MyText = "Tuesday" .... other cases Case Else MyText = "" End Select End Function - Create a table that has the matched values, and join the two tables on the integer field in a query, selecting the text field. This would be my preference since it requires no programming. Sprinks "Myron Mummey" wrote: I would like to make the value of a checkbox that is in a value group display a text valuer in a field rather than the typical numeric value of 1, 2, 3 and so on. Something on the order of if a certain box call it Monday is checked and access made its value a 1 then another field in my table will output a text value of Monday, rather then showing me the numeric value of 1. I hope this makes some kind of sense!! Thanks in advance!! Myron |
#4
|
|||
|
|||
checkbox values
Very simple solution. In the After Update event of your option group:
Me.txtDisplayDay = WeekDayName(Me.opgSelectADay, vbMonday) Using the vbMonday constant will cause WeekDay Name to return "Monday" if 1 is passed, "Tuesday" if 2 is passed, etc.) "Myron Mummey" wrote: I would like to make the value of a checkbox that is in a value group display a text valuer in a field rather than the typical numeric value of 1, 2, 3 and so on. Something on the order of if a certain box call it Monday is checked and access made its value a 1 then another field in my table will output a text value of Monday, rather then showing me the numeric value of 1. I hope this makes some kind of sense!! Thanks in advance!! Myron |
#5
|
|||
|
|||
checkbox values
Wayne/Sprinks,
Both of your ideas are great!! I will get to work on testing them out! Since posting this some of the criteria has changed as to what I need it for but it will still be useful to have!! I will let you know how it works out. Thanks!! Myron "Wayne Morgan" wrote: An option group returns the number as you indicate. You will need to format this later to display it as desired. For example, in a textbox in a report you may want Monday, Tuesday, etc to be displayed instead of the number. This could be done by using the following Control Source for the textbox. =WeekDayName([FieldName] + 1) Monday is 2, Tuesday is 3, etc. So, if your table has Monday stored as 1, add 1 to that to get 2. Another formatting option would be: =Choose([FieldName], "Monday", "Tuesday", "Wednesday") Add as many items as you need. -- Wayne Morgan MS Access MVP "Myron Mummey" wrote in message ... I would like to make the value of a checkbox that is in a value group display a text valuer in a field rather than the typical numeric value of 1, 2, 3 and so on. Something on the order of if a certain box call it Monday is checked and access made its value a 1 then another field in my table will output a text value of Monday, rather then showing me the numeric value of 1. I hope this makes some kind of sense!! Thanks in advance!! Myron |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Keeping a cell value constant trhoughout a list of values | borikua05 | Worksheet Functions | 2 | December 3rd, 2005 03:03 PM |
Updating fields... | NWO | Database Design | 8 | October 28th, 2005 08:40 AM |
Checkboxes on reports | Peter Afonin | Setting Up & Running Reports | 10 | February 11th, 2005 11:58 AM |
Average only some values | Andreas | Worksheet Functions | 2 | February 18th, 2004 10:56 AM |
finding distinct values from two lists | Frank Kabel | Worksheet Functions | 0 | February 14th, 2004 12:41 AM |