473,395 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

I need multiple option groups on one form to populate corresponding control with text

269 256MB
After a lot of searching and then even more trial and error, I made ADezii's very straightforward instructions in this post work for me.
http://bytes.com/topic/access/answer...oup-value-text
{Thank you so much ADezii. You have helped me so many times.}

However, I want to take this one step further.

I have an order form where people order plates in 6 different sizes. Those 6 sizes make my option group. However, many customers order two or three different sizes. So I have fields "Size1", "Size2", and "Size3" with 3 different options groups, but the options for the user to choose from on all three boxes are the same. My intent is to allow them to order 3 items on one form all at once. So I followed the directions here, but when I picked an option in OptionFrame2 Option Group, it only updated the Size1 box. (I understand why--because it's simply performing a match on the After_Update and the OptionFrameX is not really linked to SizeX in the code or properties.)

In case I'm not making sense, I want FrameOption1 to populate Size1 (with text, not a integer value), FrameOption2 to populate Size2, and FrameOption3 to populate Size3-----but remember, the six options are the same in all three option boxes.

Is it possible to extend ADezii's original train of thought here to fit my more complex needs? Or would we need to take a new approach? I'm a very basic user so simple is best. :-)

PS. If you are wondering why I would have an option group instead of a check box, it's because the order details for each size is different. A drop down would work as well but I think the option group is clearer for the user in my application.

Thanks in advance!!!
Mar 27 '14 #1
10 1305
Seth Schrock
2,965 Expert 2GB
Each frame has its own set of events, so in the AfterUpdate event of FrameOption1, you would reference your Size1 field in each Case statement. FrameOption2 would reference your Size2 field in each Case statement and the same for Size3.
Mar 27 '14 #2
NeoPa
32,556 Expert Mod 16PB
Hi Danica. Long time no see!

What I suggest you do for this is to create a function procedure that does the work for you and pass it a parameter for the Option Group value. The return value can then be stored in any of the string variables that you want.

Here is some example code to play with that illustrates what I'm explaining (For this I've replaced the Select Case code with a simpler call to Choose(), which is perfectly adequate for this requirement.) :
Expand|Select|Wrap|Line Numbers
  1. Private Function NumToText(ByVal lngNum As Long) As String
  2.     NumToText = Choose(lngNum, "First" _
  3.                              , "Second" _
  4.                              , "Third" _
  5.                              , "Fourth" _
  6.                              , "Fifth" _
  7.                              , "Sixth")
  8. End Function
Let me know if you have any difficulty getting this to work for you.
Mar 27 '14 #3
DanicaDear
269 256MB
Would you be able to tell me exactly what to type in my code?
Here is what I have:
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Private Sub FrameOption1_AfterUpdate()
  3.  
  4.  Select Case Me![FrameOption1]
  5.     Case 1
  6.       Me![txtValues] = "4.5x8.5"
  7.     Case 2
  8.       Me![txtValues] = "4.5x15.5"
  9.     Case 3
  10.       Me![txtValues] = "6x6"
  11.     Case 4
  12.       Me![txtValues] = "9.5x12"
  13.     Case 5
  14.       Me![txtValues] = "7 round"
  15.     Case 6
  16.       Me![txtValues] = "Unsure"
  17.   End Select
  18.   End Sub
  19.  
  20. Private Sub FrameOption2_AfterUpdate()
  21.  
  22.  Select Case Me![FrameOption2]
  23.     Case 1
  24.       Me![txtValues] = "4.5x8.5"
  25.     Case 2
  26.       Me![txtValues] = "4.5x15.5"
  27.     Case 3
  28.       Me![txtValues] = "6x6"
  29.     Case 4
  30.       Me![txtValues] = "9.5x12"
  31.     Case 5
  32.       Me![txtValues] = "7 round"
  33.     Case 6
  34.       Me![txtValues] = "Unsure"
  35.   End Select
  36.  
  37. End Sub
  38.  
  39. Private Sub FrameOption3_AfterUpdate()
  40.  
  41.  Select Case Me![FrameOption3]
  42.     Case 1
  43.       Me![txtValues] = "4.5x8.5"
  44.     Case 2
  45.       Me![txtValues] = "4.5x15.5"
  46.     Case 3
  47.       Me![txtValues] = "6x6"
  48.     Case 4
  49.       Me![txtValues] = "9.5x12"
  50.     Case 5
  51.       Me![txtValues] = "7 round"
  52.     Case 6
  53.       Me![txtValues] = "Unsure"
  54.   End Select
  55. End Sub
  56.  
Thank you Seth!!
Mar 27 '14 #4
DanicaDear
269 256MB
@DanicaDear
Hi NeoPa!! I just saw your reply. If it wouldn't hurt your feelings too bad, and IF Seth's approach is simple as it sounds, I'd like to stick with it. When you start talking about passing stuff around I get all out of sorts. LOL!! I have already invested quite a few hours in getting my first option group to work, so the hard part (for me!) is already overcome.
**So happy to hear from you again!!**
Mar 27 '14 #5
zmbd
5,501 Expert Mod 4TB
do you see this: Me![txtValues] = "4.5x8.5"

You need to change this so that it matches the name of your size fields:
Me![size1], Me![size2], Me![size3], etc...
The [txtValues] refers to the control of that name
Mar 27 '14 #6
DanicaDear
269 256MB
Ooohh, ok. Trying it now. Thank you.
That should have been obvious actually. haha
I crack myself up sometimes.
Mar 27 '14 #7
DanicaDear
269 256MB
Worked just like magic!!

Woohoooooo!!

Thanks for a quick solution guys. You are wonderful!!
Mar 27 '14 #8
NeoPa
32,556 Expert Mod 16PB
It won't hurt my feelings at all Danica. I understand how you are with VBA.

Let me see if I can set your mind at rest on this one though. I'll post the code exactly as you need it so you can see how little there is to it :
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Sub FrameOption1_AfterUpdate()
  5.     Me.txtValue1 = NumToText(Me.FrameOption1)
  6. End Sub
  7.  
  8. Private Sub FrameOption2_AfterUpdate()
  9.     Me.txtValue2 = NumToText(Me.FrameOption2)
  10. End Sub
  11.  
  12. Private Sub FrameOption3_AfterUpdate()
  13.     Me.txtValue3 = NumToText(Me.FrameOption3)
  14. End Sub
  15.  
  16. Private Function NumToText(ByVal lngNum As Long) As String
  17.     NumToText = Choose(lngNum, "4.5x8.5" _
  18.                              , "4.5x15.5" _
  19.                              , "6x6" _
  20.                              , "9.5x12" _
  21.                              , "7 round" _
  22.                              , "Unsure")
  23. End Function
I've assumed that the names of the TextBox controls are [txtValue1], [txtValue2] & [txtValue3], but you can change these easily if they are not correct.

NB. I very strongly advise you to follow the guidance found in Require Variable Declaration. It will make life a lot easier for you whenever you're working in code.
Mar 27 '14 #9
DanicaDear
269 256MB
Thank you NeoPa. Studying now. :-)
You always keep me straight...which really IS a difficult job. :-)
Mar 27 '14 #10
NeoPa
32,556 Expert Mod 16PB
It's always a pleasure Danica. I've always enjoyed our interactions and hope to hear from you again soon :-)
Mar 28 '14 #11

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

Similar topics

3
by: Tim Williams | last post by:
Hi. I'm using Python 2.3 and trying to use tkFileDialog to get a list of files. I get a message about the '-multiple' option is not a valid option in the call to Open. Python 2.3 (#1, Aug ...
4
by: Y Plas | last post by:
Hello all, i'm a new user in this group and was wandering if anyone could assisst me with a problem: I have a form with option groups within it outputig their results to a table called...
5
by: | last post by:
Hi guys, I have a form that I am using option groups on.. how can i make each option group a multi select ? thanks, kevin
20
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...
12
by: David | last post by:
Hi, I am trying to achieve the following: 1/ To have a standard form in an asp web page which has various check boxes and radio buttons. As a user selects a form item it updates a text box,...
3
by: jej1216 | last post by:
I have a form in which a select field lists 5 items pus the option of "Other." I want a text field to be hidden unless the select field value is "Other." The form is HTML, but I am assuming that I...
2
by: ckrows | last post by:
I am attempting to create a report off of 6 option groups. Each option group is a Y or N response, populating a 1 or 2 in the tables. i want to report the number a word on the report, I chose the...
1
Claus Mygind
by: Claus Mygind | last post by:
I have a <div> which defines my menu bar. I would like for this <div> to stay fixed. On the menu bar I have a list box. When the list box is set for single selection, the drop down list of...
2
by: ezhar | last post by:
int ctr = dataGridView1.CurrentCellAddress.Y; string str = dataGridView1.Value.ToString(); Form1 frm = (Form1)Application.OpenForms; frm.textBox1.Text = str; I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.