dbTalk Databases Forums  

Reading the Value or Caption From an OPtion Group Button using Select Case??

comp.databases.ms-access comp.databases.ms-access


Discuss Reading the Value or Caption From an OPtion Group Button using Select Case?? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
bezz
 
Posts: n/a

Default Reading the Value or Caption From an OPtion Group Button using Select Case?? - 08-01-2010 , 10:34 AM






Reading the Value or Caption From an OPtion Group Button using Select Case??



Normally the use of the select case seems to be as below.

Select Case Me.TPSelect

Case 1
MSgbox "You Selected 1"
Case 2
MSgbox "You Selected 1"
Case 3
MSgbox "You Selected 1"
Case 4
MSgbox "You Selected 1"
Case 5
MSgbox "You Selected 1"
Case 6
MSgbox "You Selected 1"
Case 7
MSgbox "You Selected 1"
Case 8
MSgbox "You Selected 1"

End Select

Would it be possible if say the caption was D1,D2,D3,D4 etc. to pick up the caption name and poke it
directly into a ext box to act as a filter on an underlying query for a combo box, sort of a rough
filter and a fine filter to produce an end result.

I could do it as above with the method above I know, but it would be just more compact to have a
solution like:

FirstPasstxtbox = OptionGroupPressed.Casevalue,

Or even FirstPasstxtbox = OptionGroupPressed.Caption

Thanks

J


--
--------------------------------- --- -- -
Posted with NewsLeecher v3.9 Final
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -

Reply With Quote
  #2  
Old   
bezz
 
Posts: n/a

Default Re: Reading the Value or Caption From an OPtion Group Button using Select Case?? - 08-01-2010 , 10:53 AM






Actually found a fairly easy way to do it, was getting hng up on select case...

I set up a Global Variable and then just used the sub below to store the current value in the
variable.

I can now use this to either set a text box for input to a query criteria, to return the required
records, or use the global variable from the query.

I expect there will be a better and more efficient way to do it..


Private Sub DAFrame_AfterUpdate()

GBLDesAreaID = DAFrame.Value


End Sub


--
--------------------------------- --- -- -
Posted with NewsLeecher v3.9 Final
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -

Reply With Quote
  #3  
Old   
Salad
 
Posts: n/a

Default Re: Reading the Value or Caption From an OPtion Group Button usingSelect Case?? - 08-01-2010 , 11:20 AM



bezz wrote:

Quote:
Reading the Value or Caption From an OPtion Group Button using Select Case??



Normally the use of the select case seems to be as below.

Select Case Me.TPSelect

Case 1
MSgbox "You Selected 1"
Case 2
MSgbox "You Selected 1"
Case 3
MSgbox "You Selected 1"
Case 4
MSgbox "You Selected 1"
Case 5
MSgbox "You Selected 1"
Case 6
MSgbox "You Selected 1"
Case 7
MSgbox "You Selected 1"
Case 8
MSgbox "You Selected 1"

End Select

Would it be possible if say the caption was D1,D2,D3,D4 etc. to pick up the caption name and poke it
directly into a ext box to act as a filter on an underlying query for a combo box, sort of a rough
filter and a fine filter to produce an end result.

I could do it as above with the method above I know, but it would be just more compact to have a
solution like:

FirstPasstxtbox = OptionGroupPressed.Casevalue,

Or even FirstPasstxtbox = OptionGroupPressed.Caption

Thanks

J

I've never had the need for what you are doing so there may be better way.

Of course you could modify your message box in the SelectCase statement.
to return the caption.

Anyway. I created an option group with 3 options captions; One, Two,
and Three. The values/index of the frame were 1,2,3. So I changed the
Name property for of each option's label to "LabelOpt" and the index
value. For example, the first radio/checkbox Name property would be
LabelOpt1 if it had an index of 1. I used that nameing scheme for the
rest of the option. Now I can do the following
MsgBox Me("LabelOpt" & Me.TPSelect).Caption

Reply With Quote
  #4  
Old   
bezz
 
Posts: n/a

Default Re: Reading the Value or Caption From an OPtion Group Button using Select Case?? - 08-01-2010 , 01:03 PM



Got the combo box sorted out now using the method below, as suggested.


Me("LabelOpt" & Me.TPSelect).Caption

However, the combo box does change in the underlying query, but the previous entry selected remains
in the title bar,until a new entry is selected. I have requeried the combo box using the after
update event of the option group, but this does not repopulate the combo box with the new limited
list based on the option group value. I have also tried requerying on the form with the AfterINsert
event which was suggested on a forum post, not effective either.

I suppose its a refresh I want for the data in the source query.

J


--
--------------------------------- --- -- -
Posted with NewsLeecher v3.9 Final
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -

Reply With Quote
  #5  
Old   
Salad
 
Posts: n/a

Default Re: Reading the Value or Caption From an OPtion Group Button usingSelect Case?? - 08-01-2010 , 02:59 PM



bezz wrote:
Quote:
Got the combo box sorted out now using the method below, as suggested.


Me("LabelOpt" & Me.TPSelect).Caption

However, the combo box does change in the underlying query, but the previous entry selected remains
in the title bar,until a new entry is selected.
I don't grok that line. Sorry.

I have requeried the combo box using the after
Quote:
update event of the option group, but this does not repopulate the combo box with the new limited
list based on the option group value. I have also tried requerying on the form with the AfterINsert
event which was suggested on a forum post, not effective either.

I suppose its a refresh I want for the data in the source query.

J

If your combo box columns somehow reflect caption of the option group (I
doubt since "Me." or "Me!" don't work in a query) I suppose what I'd do
is, after the option value is clicked, do a refresh of data via a
requery. This example assumes the option group frame is called Frame0.
Sub Frame0_AfterUpdate()
Me.YourComboBoxName.Requery
End Sub
So in the AfterUpdate event of the frame run the requery. You could
even enter,
Me.YourComboBoxName = Null
or
Me.YourComboBoxName = 0 'if 1st col is number
in case there is a value and you want to reset it, expecially if there
is a filter in the combo's recordsource.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.