Howdy all,
New member, first post.
I've got a form designed to be a scorecard for quality assurance monitoring in a customer service call center. The person I'm kaing the database for wants radio buttons for answering the questions - Yes, No and N/A. I'm good with this.....
The other piece to it is that he wants a way to assign a number value to each radio button to "weight" a particular question differently than other questions.
I can set the OptionValue of any radio button to what ever value he might want, but how to I make it so that he can do it simply? My thought is to have text boxes (hidden until a button "Set Score Weights" is clicked) that would hold what ever values he has chosen.
Is there a way to somehow pass the value of a textbox to set the OptionValue of a radio button? Would the textbox need to be associated with a table?
Would it be simpler to convince bossman to choose some values and do weighting in a "Score" field?
I'm really at a loss as to how to get this done cleanly.
Please help
5 4838
I'll show you how this can be done for just one Radio Button, and you can figure it out for the other 2. Let's assume that txtSetNAValue will contain the new Option Value for the Button appropriately named optNA. The following code will point you in the right direction, but has 1 Logic Bug and 1 potential problem. I'm going to bed right now, but if you need further help, either in figuring out what the Bug or Problem may be, or any questions regarding the code, either myself or one of the other Experts/Moderators/Members will be happy to Reply. - Dim lngNAOptValue As Integer
-
-
'Must contain a Value, and it must be a Number (LONG)
-
If IsNull(Me![txtSetNAValue]) Or Not IsNumeric(Me![txtSetNAValue]) Then
-
MsgBox "Invalid Entry for Option Value for N/A", vbExclamation, "Invalid Entry"
-
Exit Sub
-
Else
-
lngNAOptValue = CLng(Me![txtSetNAValue]) 'Must be a Whole Number (LONG)
-
End If
-
-
'Set an Acceptable Range of Values, if an entry goes outside of
-
'this Range, enter a Default Value
-
If lngNAOptValue < 1 Or lngNAOptValue > 500 Then
-
Me![optNA].OptionValue = 275 'Assign Default
-
Else
-
'If you get here, you have a Whole Number (LONG) within
-
'the Acceptable Range, so use it
-
Me![optNA].OptionValue = lngNAOptValue
-
End If
I like the way you help!
I enjoy figuring things out on my own when I can.....I'm glad you left me some stuff to think through.
I haven't tried the code yet (got another fire burning....) but I see something that brings up a question. Will the values in the textboxes stay there? Wouldn't they go away if he shut down the DB and restarted?....or does this code assign the textboxes "default value"?
Part two.....I've got 25 questions, each of which has the option group for answering. Is there a way to write the code once for one option group and have the form loop through the optionGroups and textboxes to get values whent he form is loaded or something?
Wouldn't they go away if he shut down the DB and restarted?
Yes they would go away, meaning the new Values would not persist. If you wanted the new Values to persist, try Opening the Form in Design Mode, make the necessary changes, then Close and Save the Form.
Is there a way to write the code once for one option group and have the form loop through the optionGroups and textboxes to get values whent he form is loaded or something?
Here is code that will loop through all the Controls in a Form, if it comes across an Option Group, it will print the Option Group Name as well as the various Options within each Group. I have also demonstrated some sample output for you along with the code. - Dim ctl As Control
-
Dim ctl2 As Control
-
-
For Each ctl In Me.Controls
-
If ctl.ControlType = acOptionGroup Then
-
Debug.Print ctl.Name
-
For Each ctl2 In ctl.Controls
-
If ctl2.ControlType = acOptionButton Then
-
Debug.Print " |-- " & ctl2.Name
-
End If
-
Next
-
End If
-
Next
OUTPUT: - fraTest
-
|-- optYes
-
|-- optNo
-
|-- optNA
-
optTest
-
|-- Option1
-
|-- Option2
-
|-- Option3
-
|-- Option4
-
|-- Option5
-
|-- Option6
@ADezii
This would negate the "ease" I'm trying to establish. The boss wants to be able to change the values as he see fits, WHEN he sees fit. He would expect the values he inputs on 12/1/08 to remain until......1/17/09 when he decides the values should be adjusted. He doesn't have the know-how, or time to open th form in design view, change default values for 50 textboxes, then save and re-open for use.
What I understand so far is that the code you gave me (which, btw, totally solved another little issue I was having! thank you!) will loop through textboxes for values to use for assigning to the controls in the option groups - assuming someone has entered values into those textboxes once the form was loaded (though, you did make a few lines for default values in the code....).
I think I've got a thought though......would this work?
I've got a form with radio buttons that need to obtain their values independant of the default settings (0,1,2 etc). You gave me code to do that, and code for some nice looping - both of which are housed in the OnOpen or whatever event for the form. Said textboxes are linked to a table that just has the numbers Mr. Bossman has chosen. The button he would click to change those values when he wants would open a form/subform doohickey linked to the table with the numbers - he can change the numbers and a record (perhaps with a date stamp) would be made for each change he does so he can konw how he came up with a score at a particular time......
I'd leave the coded defaults that you wrote in, as a precaution of sorts, and I'd have my values that won't change until bossman wants them to - and I'd have a date stamped record to show the numbers if he flubs somehow!
is this sloppy?
This would negate the "ease" I'm trying to establish. The boss wants to be able to change the values as he see fits, WHEN he sees fit. He would expect the values he inputs on 12/1/08 to remain until......1/17/09 when he decides the values should be adjusted.
- As explained previously, to have the Default Values persist, you must Open the Form in Design Mode,
-
modify the Defaults, Close the Form, and Save changes, as in:
-
Dim lngNAOptValue As Integer
-
-
'Must contain a Value, and it must be a Number
-
If IsNull(Me![txtSetNAValue]) Or Not IsNumeric(Me![txtSetNAValue]) Then
-
MsgBox "Invalid Entry for Option Value for N/A", vbExclamation, "Invalid Entry"
-
Exit Sub
-
Else
-
lngNAOptValue = CLng(Me![txtSetNAValue]) 'Must be a Whole Number (LONG)
-
End If
-
-
'Set an Acceptable Range of Values, if an entry goes outside of
-
'this Range, enter a Default Value
-
If lngNAOptValue < 1 Or lngNAOptValue > 500 Then
-
DoCmd.OpenForm "frmYourFormName", acDesign
-
Forms!frmYourFormName![optNA].OptionValue = 275 'Assign Default
-
DoCmd.Close acForm, "frmYourFormName", acSaveYes
-
Else
-
'If you get here, you have a Whole Number (LONG) within
-
'the Acceptable Range, so use it
-
DoCmd.OpenForm "frmYourFormName", acDesign
-
Forms!frmYourFormName![optNA].OptionValue = lngNAOptValue
-
DoCmd.Close acForm, "frmYourFormName", acSaveYes
-
End If
What I understand so far is that the code you gave me (which, btw, totally solved another little issue I was having! thank you!) will loop through textboxes for values to use for assigning to the controls in the option groups - assuming someone has entered values into those textboxes once the form was loaded (though, you did make a few lines for default values in the code....).
No! The code will Loop through all Controls on a Form and if it finds an Option Group, it will list the Controls within that Group along with the Name of the Option Group. The rest I leave to you.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Edward |
last post by:
I have a data entry form that allows the user to navigate around
entirely using the keyboard. However, it contains various option
button controls which are in the tab order. Whenever they are...
|
by: Mokoena |
last post by:
How do I get radio buttons to work in HTML, so that only one in a group can
be selected at a time? How do I get the value returned from them? How do I
reference them in JavaScript? What value is...
|
by: Rick |
last post by:
After being frustrated with this issue on several occasions I think I
found the secret sauce for solving the issue after reading a few
different messages about what others thought and trying a...
|
by: What-a-Tool |
last post by:
I have a school project (ASP) in which I have to call three different ASP
pages from three different and identical (except for the form "action",
obviously) HTM pages. This I have no problem with....
|
by: Robert |
last post by:
Hello.
I have been trying out the Lebans ToolTip Classes at
http://www.lebans.com/tooltip.htm, to display "balloon" style help tips in a
form. The classes I am using are located at...
|
by: MLH |
last post by:
Why is that?
If I choose the tiny check boxes which are hard to
hit with a mouse, it works fine. But option buttions,
shich can be sized big enough for people with limited
sight and dexterity...
|
by: PC Datasheet |
last post by:
How can the label for a checkbox and the labels for the options in an option
group be addressed? When a checkbox gets the focus, Access draws a dotted
box around the label. When an option group...
|
by: NishSF |
last post by:
Would anyone have any suggestions/javascript code so that if one clicks
the Radio Button "Yes" below he has the option of selecting any of the
six CheckBox below. If the user clicks on Radio Button...
|
by: Sin Jeong-hun |
last post by:
Suppose there are 4 radion buttons on the form. There's no groupbox or
panel to seperate them. By default, the 4 radio buttons are mutually
exclusive. Is it possible to group them into two groups?...
|
by: moksha |
last post by:
Hi,
I am new to javascript and i am facing a problem in coding.
plz help me out.
I am using javascript for dynamically creating a table row which contains text boxes and radio...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |