473,395 Members | 1,537 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.

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.Enabled = False
for all the options that I wanted to be disabled
and
Forms![Options Form].Option3.Enabled = 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 1656
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.*********@heuvelqop.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(enabler As Boolean)
isEnabled = enabler
End Sub

From the other form, you can then call

OptionForm.SetEnable True

In the form, you can then have code such as

With Me
.Option1.Enabled = Not isEnabled
.Option2.Enabled = isEnabled
.Option3.Enabled = isEnabled
.Option4.Enabled = isEnabled
.Option5.Enabled = 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.com...
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.Enabled = False
for all the options that I wanted to be disabled
and
Forms![Options Form].Option3.Enabled = 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(optionNumber As Integer)
optToEnable = optionNumber
End Sub

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

OptionForm.SetEnable 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).Enabled = 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*********@comcast.net> wrote:
Private optToEnable as Integer

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

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

OptionForm.SetEnable 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).Enabled = 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
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...
3
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) {...
20
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...
2
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"...
7
by: The Doctor | last post by:
A rather elementary question, In VB5, how can I pass a variable from one form to another?
4
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...
6
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...
1
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...
3
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...
3
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...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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,...
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
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.