473,513 Members | 3,328 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Option Group with literal argument


I have 4 option groups with the same choices in each group so I want to
create a module with a public function that would be activated on_click
event.
Public Function OptionSelection(varOption As Variant)

Select Case Forms!frmRecruitment!varOption.Value
Case 1
Forms!frmRecruitment!varOption.Value = 1
Case 2
Forms!frmRecruitment.varOption.Value = 2
Case 3
Forms!frmRecruitment.varOption.Value = 5
End Select
If Forms!frmRecruitment.varOption.Value = 5 Then
Forms!frmRecruitment.strRemarks.SetFocus
End If

End Function
I get a run-time error 2465
Microsoft Access can't find the field "varOption" referred to in your
expression. Can someone please tell me what is wrong with this code?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
2 1246
What are you passing: the name of the option group, or a reference to it?

If the name, use Forms!frmRecruitment.Controls(varOption).Value (and pass it
as a string, not a variant)

If a reference to the control, use varOption.Value (and change the
declaration from varOption As Variant to varOption As Control)
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"margamo" <an*******@devdex.com> wrote in message
news:40*********************@news.frii.net...

I have 4 option groups with the same choices in each group so I want to
create a module with a public function that would be activated on_click
event.
Public Function OptionSelection(varOption As Variant)

Select Case Forms!frmRecruitment!varOption.Value
Case 1
Forms!frmRecruitment!varOption.Value = 1
Case 2
Forms!frmRecruitment.varOption.Value = 2
Case 3
Forms!frmRecruitment.varOption.Value = 5
End Select
If Forms!frmRecruitment.varOption.Value = 5 Then
Forms!frmRecruitment.strRemarks.SetFocus
End If

End Function
I get a run-time error 2465
Microsoft Access can't find the field "varOption" referred to in your
expression. Can someone please tell me what is wrong with this code?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #2
Thanks a lot I was confused about the difference between passing the
name or the value. I wanted to pass the name. Your input was very
helpful.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3521
by: Steven T. Hatton | last post by:
This is from the draft of the previous version of the Standard: http://www.kuzbass.ru:8086/docs/isocpp/expr.html 2- A literal is a primary expression. Its type depends on its form (lex.literal). A string literal is an *lvalue*; all other literals are *rvalues*. -4- The operator :: followed by an identifier, a qualified-id, or an...
10
4844
by: David | last post by:
Can anyone give me a quick code snippet (that is standards-based) for adding OPTION tags to a SELECT dynamically. I have no problem doing it in IE but I am kind of new to the whole standards world and can't figure out how to make it work in, for instance, Firefox. Right now the code I am using is as follows: ...
20
5126
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 gets the focus, Access draws a dotted box around the label of the first option or the label of the option previously selected. I would like to change...
3
1747
by: celineusa | last post by:
Hello! Here is part of my database: tblStudents: StudentID tblMajorsAndStudents: StudentID, MajorID tblMajors: MajorID tblMajorsAndClasses: MajorID, ClassID, QuarterTaken tblClasses: ClassID tblStudentsAndClasses: StudentID, ClassID
7
4346
by: al | last post by:
char s = "This string literal"; or char *s= "This string literal"; Both define a string literal. Both suppose to be read-only and not to be modified according to Standard. And both have type of "const char *". Right? But why does the compiler I am using allow s to be modified, instead of generating compile error?
4
5373
by: songkv | last post by:
Hi, I am trying to reassign an array of char to a string literal by calling a function. In the function I use pointer-to-pointer since I want to reassign the "string array pointer" to the string literal. But the second printf seems to give me garbage. Any advise on what I am doing wrong? Thanx
15
3312
by: Ramaraj M Bijur | last post by:
Hi All, Could anyone help me to resolve following problem in C the IDE used is Microsoft VC++, Please let me know the which option in VC++ will do the needful The problem statement: overwrite of charcter in constatnt string like char *str="Hi all"; str='A'; the result of this str points to the string "Hi All"
6
1758
by: ladybug76 | last post by:
Hello. Okay, so I have an Option Group with 6 reports on the Right hand side of a form. On the left, I have 4 command buttons. 1) Preview 2) Print 3) Save off 4) Email. I want the user to be able to select a report's radio button and click one of the four command buttons. Currently, Preview and Print work. But the Reports have...
1
7303
by: vraamu | last post by:
here in this option transfer code.after transfering data from available _services multiple box to assigned_services multiple box i am unable to get the value of the assigned_services data for ex in this <option value ="0" >Admin</option> <option value ="1" >Public</option> i am not getting 0 and 1 but i am getting admin,public {php}...
0
7563
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7125
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7543
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5102
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4757
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3252
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.