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
|
|||
|
|||
Show/Hide Option Buttons Access 2007
I just got Access 2007 the other day and I'm poking about with various
functions, but, I want to do something and I can't figure out how to do it. I have three Option Buttons with a label next to them. What I want to do is the following: If I select Option 1, the other two options should grey out (Enabled = False I think?) and the label go "dim" as well. and if I select option 2, 1 and 3 should grey out along with the labels. and so on... Now, I can't for the life of me figure out how to do this, so any help would be gratefully received. Thanks in advance. |
#2
|
|||
|
|||
Show/Hide Option Buttons Access 2007
And if you do that and change your mind then what do you propose to do?
You've locked at the ability to change the data in the form at this point. To do this, you would need a sub like the following. Private Sub sSetFrameEnabled() Select NZ(Case Me.Frame19,0) Case 0 Me.Option22.Enabled = True Me.Option24.Enabled = True Me.Option26.Enabled = True Case 1 Me.Option22.Enabled = True Me.Option24.Enabled = False Me.Option26.Enabled = False Case 2 Me.Option22.Enabled = False Me.Option24.Enabled = True Me.Option26.Enabled = False Case 3 Me.Option22.Enabled = False Me.Option24.Enabled = False Me.Option26.Enabled = True End Select End Sub You call that sub in the Frame's (option group control) on update event and if you want that same functionality when you move from record to record you will need to call the code in the FORM's Current event. John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County RedBeard wrote: I just got Access 2007 the other day and I'm poking about with various functions, but, I want to do something and I can't figure out how to do it. I have three Option Buttons with a label next to them. What I want to do is the following: If I select Option 1, the other two options should grey out (Enabled = False I think?) and the label go "dim" as well. and if I select option 2, 1 and 3 should grey out along with the labels. and so on... Now, I can't for the life of me figure out how to do this, so any help would be gratefully received. Thanks in advance. |
#3
|
|||
|
|||
Show/Hide Option Buttons Access 2007
The question that I then ask, is: What is the user supposed to do if
he/she picks the wrong one by accident? You have just disabled the remaining selections so they can't change their mind. What I usually do as an alternative is to make the lbl for the selected option bold property true and the bold property for the others false. That way they can change their mind. (OR make the proper selection that they really wanted.) The logic is exactly the same as the suggested code except that it is the bold property (for the associated lbl) that is set to true or false. Ron |
#4
|
|||
|
|||
Show/Hide Option Buttons Access 2007
Well, I was thinking about doing a little quizgame thing to practice
how access works. No time for second guesses I appreciate the code below, but I don't quite get what Me.Frame19,0 does, would you mind elaborating? Thanks On Jul 27, 5:08*pm, John Spencer wrote: And if you do that and change your mind then what do you propose to do? You've locked at the ability to change the data in the form at this point.. To do this, you would need a sub like the following. Private Sub sSetFrameEnabled() * * Select NZ(Case Me.Frame19,0) * * * *Case 0 * * * * * Me.Option22.Enabled = True * * * * * Me.Option24.Enabled = True * * * * * Me.Option26.Enabled = True * * * *Case 1 * * * * * Me.Option22.Enabled = True * * * * * Me.Option24.Enabled = False * * * * * Me.Option26.Enabled = False * * * *Case 2 * * * * * Me.Option22.Enabled = False * * * * * Me.Option24.Enabled = True * * * * * Me.Option26.Enabled = False * * * *Case 3 * * * * * Me.Option22.Enabled = False * * * * * Me.Option24.Enabled = False * * * * * Me.Option26.Enabled = True * * End Select End Sub You call that sub in the Frame's (option group control) on update event and if you want that same functionality when you move from record to record you will need to call the code in the FORM's Current event. John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County |
#5
|
|||
|
|||
Show/Hide Option Buttons Access 2007
Nz(Me.Frame19,0) forces a value of zero if no option has been selected.
If you are on a new record and the Option group is bound to a field (and you haven't set a default value for the option group) the option group value will be null. The Nz replaces Null with zero so the case statement will work. If you do have a default value of zero, then there is no problem. John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County RedBeard wrote: Well, I was thinking about doing a little quizgame thing to practice how access works. No time for second guesses I appreciate the code below, but I don't quite get what Me.Frame19,0 does, would you mind elaborating? Thanks On Jul 27, 5:08 pm, John Spencer wrote: And if you do that and change your mind then what do you propose to do? You've locked at the ability to change the data in the form at this point. To do this, you would need a sub like the following. Private Sub sSetFrameEnabled() Select NZ(Case Me.Frame19,0) Case 0 Me.Option22.Enabled = True Me.Option24.Enabled = True Me.Option26.Enabled = True Case 1 Me.Option22.Enabled = True Me.Option24.Enabled = False Me.Option26.Enabled = False Case 2 Me.Option22.Enabled = False Me.Option24.Enabled = True Me.Option26.Enabled = False Case 3 Me.Option22.Enabled = False Me.Option24.Enabled = False Me.Option26.Enabled = True End Select End Sub You call that sub in the Frame's (option group control) on update event and if you want that same functionality when you move from record to record you will need to call the code in the FORM's Current event. John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County |
#6
|
|||
|
|||
Show/Hide Option Buttons Access 2007
On Jul 27, 9:56*pm, John Spencer wrote:
Nz(Me.Frame19,0) forces a value of zero if no option has been selected. If you are on a new record and the Option group is bound to a field (and you haven't set a default value for the option group) the option group value will be null. *The Nz replaces Null with zero so the case statement will work. If you do have a default value of zero, then there is no problem. John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County RedBeard wrote: Well, I was thinking about doing a little quizgame thing to practice how access works. No time for second guesses * I appreciate the code below, but I don't quite get what Me.Frame19,0 does, would you mind elaborating? Thanks On Jul 27, 5:08 pm, John Spencer wrote: And if you do that and change your mind then what do you propose to do? You've locked at the ability to change the data in the form at this point. To do this, you would need a sub like the following. Private Sub sSetFrameEnabled() * * Select NZ(Case Me.Frame19,0) * * * *Case 0 * * * * * Me.Option22.Enabled = True * * * * * Me.Option24.Enabled = True * * * * * Me.Option26.Enabled = True * * * *Case 1 * * * * * Me.Option22.Enabled = True * * * * * Me.Option24.Enabled = False * * * * * Me.Option26.Enabled = False * * * *Case 2 * * * * * Me.Option22.Enabled = False * * * * * Me.Option24.Enabled = True * * * * * Me.Option26.Enabled = False * * * *Case 3 * * * * * Me.Option22.Enabled = False * * * * * Me.Option24.Enabled = False * * * * * Me.Option26.Enabled = True * * End Select End Sub You call that sub in the Frame's (option group control) on update event and if you want that same functionality when you move from record to record you will need to call the code in the FORM's Current event. John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County Well, this was more complicated than I imagined I don't suppose you know of any beginner tutorials I could have a look at to understand better? Thanks for all the help! |
#7
|
|||
|
|||
Show/Hide Option Buttons Access 2007
You can check out the following for basics on Access.
Jeff Conrad's resources page: http://www.accessmvp.com/JConrad/acc...resources.html The Access Web resources page: http://www.mvps.org/access/resources/index.html A free tutorial written by Crystal (MS Access MVP): http://allenbrowne.com/casu-22.html http://www.everythingaccess.com/tuto...-free-tutorial MVP Allen Browne's tutorials: http://allenbrowne.com/links.html#Tutorials Here's a primer with 23 well defined, well written, clearly named chapters: http://www.functionx.com/vbaccess/index.htm -- I have a Word document I call Access Links.doc, that I think you will find quite helpful. You can download a zipped copy from he http://www.accessmvp.com/TWickerath/ For the present time, concentrate on just the first couple of pages. This includes information on special characters to avoid, reserved words, database design, best practices (make sure that you have the latest updates), Name Autocorrect, Relationships, along with a lot of useful links to other web sites. Also, head on over to Access MVP Crystal's new site and download her Access Basics tutorials: http://www.accessmvp.com/Strive4Peace/Index.htm Tom Wickerath Microsoft Access MVP http://www.accessmvp.com/TWickerath/ http://www.access.qbuilt.com/html/ex...tributors.html __________________________________________ John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County RedBeard wrote: On Jul 27, 9:56 pm, John Spencer wrote: Nz(Me.Frame19,0) forces a value of zero if no option has been selected. If you are on a new record and the Option group is bound to a field (and you haven't set a default value for the option group) the option group value will be null. The Nz replaces Null with zero so the case statement will work. If you do have a default value of zero, then there is no problem. John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County RedBeard wrote: Well, I was thinking about doing a little quizgame thing to practice how access works. No time for second guesses I appreciate the code below, but I don't quite get what Me.Frame19,0 does, would you mind elaborating? Thanks On Jul 27, 5:08 pm, John Spencer wrote: And if you do that and change your mind then what do you propose to do? You've locked at the ability to change the data in the form at this point. To do this, you would need a sub like the following. Private Sub sSetFrameEnabled() Select NZ(Case Me.Frame19,0) Case 0 Me.Option22.Enabled = True Me.Option24.Enabled = True Me.Option26.Enabled = True Case 1 Me.Option22.Enabled = True Me.Option24.Enabled = False Me.Option26.Enabled = False Case 2 Me.Option22.Enabled = False Me.Option24.Enabled = True Me.Option26.Enabled = False Case 3 Me.Option22.Enabled = False Me.Option24.Enabled = False Me.Option26.Enabled = True End Select End Sub You call that sub in the Frame's (option group control) on update event and if you want that same functionality when you move from record to record you will need to call the code in the FORM's Current event. John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County Well, this was more complicated than I imagined I don't suppose you know of any beginner tutorials I could have a look at to understand better? Thanks for all the help! |
#8
|
|||
|
|||
Show/Hide Option Buttons Access 2007
You can check out the following for basics on Access.
Jeff Conrad's resources page: http://www.accessmvp.com/JConrad/acc...resources.html The Access Web resources page: http://www.mvps.org/access/resources/index.html A free tutorial written by Crystal (MS Access MVP): http://allenbrowne.com/casu-22.html http://www.everythingaccess.com/tuto...-free-tutorial MVP Allen Browne's tutorials: http://allenbrowne.com/links.html#Tutorials Here's a primer with 23 well defined, well written, clearly named chapters: http://www.functionx.com/vbaccess/index.htm John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County RedBeard wrote: Well, this was more complicated than I imagined I don't suppose you know of any beginner tutorials I could have a look at to understand better? Thanks for all the help! |
#9
|
|||
|
|||
Show/Hide Option Buttons Access 2007
On Jul 28, 3:15*pm, John Spencer wrote:
You can check out the following for basics on Access. Jeff Conrad's resources page:http://www.accessmvp.com/JConrad/acc...resources.html The Access Web resources page:http://www.mvps.org/access/resources/index.html A free tutorial written by Crystal (MS Access MVP):http://allenbrowne.com/casu-22.htmlh...-basics%3A-fre... MVP Allen Browne's tutorials:http://allenbrowne.com/links.html#Tutorials Here's a primer with 23 well defined, well written, clearly named chapters:http://www.functionx.com/vbaccess/index.htm John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County RedBeard wrote: Well, this was more complicated than I imagined * I don't suppose you know of any beginner tutorials I could have a look at to understand better? Thanks for all the help! Even though some very nice people provided me with help and gave examples, I still don't understand Option Groups at all. I went back a step and tried simplifying everything but I just don't get it. What I currently have is this: A form with an Option group that has three options and one text box. What I want to accomplish is this: selecting the topmost option displays 1 in the text box, second option displays a 2 and option 3 should show a 3. Help please, I feel so dumb |
#10
|
|||
|
|||
Show/Hide Option Buttons Access 2007
If you used the wizard to set up the option group, then each option in the
group sets the value of the option group to a value from 1 to n (n being the number of options you have in the option group). The option group (probably named frame something) is where the value is changed (stored). So if you have a text box next to the option group, you should be able to set its source to =[NameOfOptionGroupControl] Or you can use the option group's after update event to set the value of the text box control Me.NameOfTextBox = Me.NameOfOptionGroupControl You can bind (set the control's source) either (or both) controls to a field. If you bind both controls to the same field then changing the value in one should automatically change the value in the other since they are both showing the value of the field. John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County RedBeard wrote: On Jul 28, 3:15 pm, John Spencer wrote: You can check out the following for basics on Access. Jeff Conrad's resources page:http://www.accessmvp.com/JConrad/acc...resources.html The Access Web resources page:http://www.mvps.org/access/resources/index.html A free tutorial written by Crystal (MS Access MVP):http://allenbrowne.com/casu-22.htmlh...-basics%3A-fre... MVP Allen Browne's tutorials:http://allenbrowne.com/links.html#Tutorials Here's a primer with 23 well defined, well written, clearly named chapters:http://www.functionx.com/vbaccess/index.htm John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County RedBeard wrote: Well, this was more complicated than I imagined I don't suppose you know of any beginner tutorials I could have a look at to understand better? Thanks for all the help! Even though some very nice people provided me with help and gave examples, I still don't understand Option Groups at all. I went back a step and tried simplifying everything but I just don't get it. What I currently have is this: A form with an Option group that has three options and one text box. What I want to accomplish is this: selecting the topmost option displays 1 in the text box, second option displays a 2 and option 3 should show a 3. Help please, I feel so dumb |
Thread Tools | |
Display Modes | |
|
|