473,698 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing and using option values in code..

I have a form with about 20 option buttons. In some instances, when
the form is opened, only 1 option button is enabled and the others are
disabled. This is controlled by criteria from another form.

I did this by writing
Forms![Options Form].Option5.Enable d = False
for all the options that I wanted to be disabled
and
Forms![Options Form].Option3.Enable d = True
for the one to be enabled.

I did this for all the options that could potentially be disabled and
I think it must be a very sloppy way to do it, even if it does work.

I would like to be able to send the option number to one function that
would disable all the options and enable the one option that was sent.

I tried sending Option5 as a string but that didn't work. I really
don't know enough about access to figure this out so if someone could
help I would really appreciate it.

Thank you,

J Green
Nov 13 '05 #1
5 1674
ShyGuy wrote:
I have a form with about 20 option buttons. In some instances, when
the form is opened, only 1 option button is enabled and the others are
disabled. This is controlled by criteria from another form.


What if you use an option group? That will handle most of the interface
issues for you

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #2
On Tue, 23 Nov 2004 22:06:34 +0100, Bas Cost Budde
<b.*********@he uvelqop.nl> wrote:
ShyGuy wrote:
I have a form with about 20 option buttons. In some instances, when
the form is opened, only 1 option button is enabled and the others are
disabled. This is controlled by criteria from another form.


What if you use an option group? That will handle most of the interface
issues for you

Thanks for the reply,

Sorry I didn't mention that. I am using an option group. What I am
trying to do is, depending on criteria from another form, certain
options are disabled so that the user cannot select them.

Nov 13 '05 #3
In the OptionForm, declare

Private isEnabled as Boolean

Public Sub SetEnable(enabl er As Boolean)
isEnabled = enabler
End Sub

From the other form, you can then call

OptionForm.SetE nable True

In the form, you can then have code such as

With Me
.Option1.Enable d = Not isEnabled
.Option2.Enable d = isEnabled
.Option3.Enable d = isEnabled
.Option4.Enable d = isEnabled
.Option5.Enable d = Not isEnabled
End With

This may not work out exactly the same if you have several different
configurations of enable/disable, but the principle is the same for
configuration 1, 2, etc. Keep in mind that this won't do anything to speed
your code up, just to make it easier to read and maintain.
Darryl Kerkeslager

"ShyGuy" <sh****@shytown .com> wrote in message
news:od******** *************** *********@4ax.c om...
I have a form with about 20 option buttons. In some instances, when
the form is opened, only 1 option button is enabled and the others are
disabled. This is controlled by criteria from another form.

I did this by writing
Forms![Options Form].Option5.Enable d = False
for all the options that I wanted to be disabled
and
Forms![Options Form].Option3.Enable d = True
for the one to be enabled.

I did this for all the options that could potentially be disabled and
I think it must be a very sloppy way to do it, even if it does work.

I would like to be able to send the option number to one function that
would disable all the options and enable the one option that was sent.

I tried sending Option5 as a string but that didn't work. I really
don't know enough about access to figure this out so if someone could
help I would really appreciate it.

Thank you,

J Green

Nov 13 '05 #4
Private optToEnable as Integer

Public Sub SetEnable(optio nNumber As Integer)
optToEnable = optionNumber
End Sub

-------------------------------
Call by:

OptionForm.SetE nable 3
---------------------------------
Assuming your option groups are numbered Option1 to Option9,

Dim i As Integer
For i = 1 to 9
Me("Option" & i).Enabled = False
Next i
Me("Option" & optToEnable).En abled = True

"ShyGuy" <sh****@shytown .com> wrote:
Thank you. Is there a way to pass the option number to be enabled to
a function and ust the passed option number in code to enable that
option? This way I would only need 1 function to cover all the
different possible options.


Nov 13 '05 #5
On Tue, 23 Nov 2004 21:51:49 -0500, "Darryl Kerkeslager"
<Ke*********@co mcast.net> wrote:
Private optToEnable as Integer

Public Sub SetEnable(optio nNumber As Integer)
optToEnable = optionNumber
End Sub

-------------------------------
Call by:

OptionForm.Set Enable 3
---------------------------------
Assuming your option groups are numbered Option1 to Option9,

Dim i As Integer
For i = 1 to 9
Me("Option" & i).Enabled = False
Next i
Me("Option" & optToEnable).En abled = True

Thank you so much. This was just what I was looking for and it worked
perfectly!
Nov 13 '05 #6

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

Similar topics

12
6548
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the courses to pass the correct option value and then be displayed at the following URL: http://www.dslextreme.com/users/kevinlyons/selectResults.html I am passing countries, products, and courses. The first two display
3
14939
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) { document.images.src = eval("mt" +menu+ ".src") } alert("imgOff_hidemenu"); hideMenu=setTimeout('Hide(menu,num)',500);
20
4842
by: Glenn Venzke | last post by:
I'm writing a class with a method that will accept 1 of 3 items listed in an enum. Is it possible to pass the item name without the enum name in your calling statement? EXAMPLE: public enum EnumName FirstValue = 1 SecondValue = 2 ThirdValue = 3
2
2916
by: Peter | last post by:
Hello I have the following tag <select name="cat" id="cat" onchange="popUpWin('cmPhaseReload.php?category='+document.getElementById('cat').options.value ,600,600,'yes')" class="tbl_result" size="1"> the cat field is a drop down list
7
8184
by: The Doctor | last post by:
A rather elementary question, In VB5, how can I pass a variable from one form to another?
4
2712
by: assgar | last post by:
Hi I am stuck on a problem. I use 3 scripts(form, function and process). Development on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. The form displays multiple dynamic rows with chechboxs, input box for units of service, description of the service and each row has its own dropdown list of unit fees that apply.
6
2638
by: jej1216 | last post by:
I am trying to put together a PHP search page in which the user can select none, one, two, or three fields to search, and then the results php will build the SQL with dynamic where caluses to reflect the fields chosen. The first page, where they select the search fields and submit: <?php $db = mysql_connect("localhost", "root", "yeahright"); if (!$db) { die('Could not connect:'.mysql_error);
1
2176
by: mbcode | last post by:
I am trying to use a Javascript picklist box and then echo the chosen values back to the screen (and insert in the db later) but I am getting the Button value rather than the list values. I have followed the advice on the forum to us and ID and getElementByID in the <select> line, but no luck. Thanks in advance HTML </head> <body> <form method="post" name="combo_box" action=subscribe3.php> <table cellpadding="4" cellspacing="0"...
3
4494
by: ajaymohank | last post by:
hello everyone..... i am ajay and i am new to php. in my project i have an option to invoke a bat file by passing parrameters and to diplay the result. i tried this code but my page got hung or display nothing... exec("c:\collabland\collabland.bat $distcode $tlkcode $villacod $block $svno"); here by passing this parameters to collabland.bat, a sketch will be generated based on the parameters and it should be displayed. when i type in...
3
6115
by: dixiebuyer | last post by:
I have a project I am porting to the Web from stand alone Access and Word with VB. I have been pleased with LAMP so far, but this one part of the project is killing me! Basically what I want to do is take the gender from a drop down box, and based on the selection, I would like to populate the drop down box for relation - i.e. male would return values such as son, father, uncle and female would return daughter, mother, aunt. Although it may...
0
8674
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8861
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7725
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3046
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
2
2329
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.