how to get option group value?

H

Herbert Chan

Hi,

I've just setup a form with the following:

option group named "grpPFF" with 6 options
a command button named "cmdMonthly"

I have the following procedure:

Private Sub cmdMonthly_Click()
Select Case grpPFF
Case Is = 1
MsgBox "TM38"
Case Is = 2
MsgBox "TKO137"
Case Is = 3
MsgBox "KT"
Case Is = 4
MsgBox "SYP"
Case Is = 5
MsgBox "qb"
Case Is = 6
MsgBox "mw"
End Select
End Sub

However, I get execution error 438 with Select Case grpPFF. And I still get
the error even if I replace it with Me.grpPFF.

What have I got wrong? It seemed to be a simple procedure. I'm stumped:(

Herbert
 
H

Herbert Chan

The problem is still there. It still highlights the grpPFF line yellow.

I think I must be missing something very basic.

No matter I have either (Case 1 or Case Is = 1) or (grpPFF or Me.grpPFF),
there still is error 438.

Herbert
 
C

CSmith

You might have a code error somewhere else that's affecting this. Try
compiling your code to see if something else pops up.
 
H

Herbert Chan

I've compiled it an no error turns up.

And the following is all I have on this module for the form:

Option Compare Database
Option Explicit

Private Sub cmdMonthly_Click()
Select Case Me.grpPFF
Case 1
MsgBox "TM38"
Case 2
MsgBox "TKO137"
Case 3
MsgBox "KT"
Case 4
MsgBox "SYP"
Case 5
MsgBox "qb"
Case 6
MsgBox "mw"
End Select
End Sub

Herbert
 
H

Herbert Chan

I know now!!!!!!!!

I've named the textbox of the option group caption grpPFF rather than the
option group itself!!!!!!!

Herbert
 
P

prabha

Hi Herbert,

Get rid of
Case Is = 1

and replace it with
Case 1:

note: same for each Case statement

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."



--------------------
| From: "Herbert Chan" <[email protected]>
| Subject: how to get option group value?
| Date: Sun, 8 Feb 2004 14:32:48 +0800
| Lines: 34
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| FL-Build: Fidolook 2002 (SL) 6.0.2800.85 - 28/1/2003 19:07:30
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.access.formscoding
| NNTP-Posting-Host: cm61-10-122-57.hkcable.com.hk 61.10.122.57
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.
phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.access.formscoding:219648
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| Hi,
|
| I've just setup a form with the following:
|
| option group named "grpPFF" with 6 options
| a command button named "cmdMonthly"
|
| I have the following procedure:
|
| Private Sub cmdMonthly_Click()
| Select Case grpPFF
| Case Is = 1
| MsgBox "TM38"
| Case Is = 2
| MsgBox "TKO137"
| Case Is = 3
| MsgBox "KT"
| Case Is = 4
| MsgBox "SYP"
| Case Is = 5
| MsgBox "qb"
| Case Is = 6
| MsgBox "mw"
| End Select
| End Sub
|
| However, I get execution error 438 with Select Case grpPFF. And I still
get
| the error even if I replace it with Me.grpPFF.
|
| What have I got wrong? It seemed to be a simple procedure. I'm stumped:(
|
| Herbert
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top