473,403 Members | 2,222 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,403 software developers and data experts.

Form drop down box options

I have a form that displays a dropdown box. The options in the drop down
vary according to a value queried from a database boolean (Yes/No) field. I
would like to do the following:

If the boolean value is True, then the dropdown options will be option1 and
option2.

If the boolean value is False, then the dropdown box will contain: option1,
option2 and option3.

That's it. The value of the boolean field will determine if the form
dropdown box contains either two or three options.

I have created the query which works fine. Unfortunately, I cannot figure
out how to populate the dropdown options according to the boolean value (True
or False) that is retrieved in the query

Cannot anyone help me out? Thanks

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200710/1

Oct 10 '07 #1
3 5851
On Oct 10, 8:22 am, "dufnobles via AccessMonster.com" <u37896@uwe>
wrote:
I have a form that displays a dropdown box. The options in the drop down
vary according to a value queried from a database boolean (Yes/No) field. I
would like to do the following:

If the boolean value is True, then the dropdown options will be option1 and
option2.

If the boolean value is False, then the dropdown box will contain: option1,
option2 and option3.

That's it. The value of the boolean field will determine if the form
dropdown box contains either two or three options.

I have created the query which works fine. Unfortunately, I cannot figure
out how to populate the dropdown options according to the boolean value (True
or False) that is retrieved in the query

Cannot anyone help me out? Thanks

--
Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2007...
So, is there just one record in the query? Or is the boolean value
the same in all records? Or does the user select one of the records
before clicking on the combo box? Combo boxes can take a SQL string
as a rowsource. Are the options part of a table, or are they
hardwired? Combo boxes can take a literal string or a recordset as
the rowsource; just change the RowSourceType to the one you want.

Oct 10 '07 #2
Thanks OldPro,

I think I'm beginning to understand.

My query returns several records, each record has the boolean field which is
either 'Yes' or 'No' ( as well as several other fields as well).

Right now, the combo boxe options for each record are hard coded on the
form for just two options (this is obviously wrong). The third option never
shows up.

I think I need a rowSource to populate the box instead, as you suggested.
Right now, all information comes from a simple query: 'Select * from tableX'.
How would I go about creating this separate rowSource that you spoke of to
fill the combo box based on the True or False value stored in the tableX
query. Should this be another query, should I create another table or should
I make my original query more complicated?

I am very new at this,what is the easiest solution. Thanks so much for your
patience.
OldPro wrote:
>On Oct 10, 8:22 am, "dufnobles via AccessMonster.com" <u37896@uwe>
wrote:
>I have a form that displays a dropdown box. The options in the drop down
vary according to a value queried from a database boolean (Yes/No) field. I
[quoted text clipped - 17 lines]
>--
Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2007...

So, is there just one record in the query? Or is the boolean value
the same in all records? Or does the user select one of the records
before clicking on the combo box? Combo boxes can take a SQL string
as a rowsource. Are the options part of a table, or are they
hardwired? Combo boxes can take a literal string or a recordset as
the rowsource; just change the RowSourceType to the one you want.
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200710/1

Oct 10 '07 #3
On Oct 10, 9:37 am, "dufnobles via AccessMonster.com" <u37896@uwe>
wrote:
Thanks OldPro,

I think I'm beginning to understand.

My query returns several records, each record has the boolean field which is
either 'Yes' or 'No' ( as well as several other fields as well).

Right now, the combo boxe options for each record are hard coded on the
form for just two options (this is obviously wrong). The third option never
shows up.

I think I need a rowSource to populate the box instead, as you suggested.
Right now, all information comes from a simple query: 'Select * from tableX'.

How would I go about creating this separate rowSource that you spoke of to
fill the combo box based on the True or False value stored in the tableX
query. Should this be another query, should I create another table or should
I make my original query more complicated?

I am very new at this,what is the easiest solution. Thanks so much for your
patience.

OldPro wrote:
On Oct 10, 8:22 am, "dufnobles via AccessMonster.com" <u37896@uwe>
wrote:
I have a form that displays a dropdown box. The options in the drop down
vary according to a value queried from a database boolean (Yes/No) field. I
[quoted text clipped - 17 lines]
--
Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2007...
So, is there just one record in the query? Or is the boolean value
the same in all records? Or does the user select one of the records
before clicking on the combo box? Combo boxes can take a SQL string
as a rowsource. Are the options part of a table, or are they
hardwired? Combo boxes can take a literal string or a recordset as
the rowsource; just change the RowSourceType to the one you want.

--
Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2007...
I still need to know which record determines whether the combo box has
two or three items. It can still be hard coded, that's probably the
easiest way with only two or three items. Does the user select one of
the records before clicking on the combo box? If so, then put code in
the after update event of the control where the user selects the
record.
If userSelectsA then
cmbOptions.RowSource="Option One,Option Two,Option Three"
else
cmbOptions.RowSource="Option One,Option Two"
endif
Oct 11 '07 #4

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

Similar topics

0
by: Steve Edwards | last post by:
I am working on a site where I need to create forms to both add and edit information for a group of products. I would like to use the same form for both adding new and edit data for existing...
14
by: alwayshouston | last post by:
Hi All! I am working on this very small database and I am confused in the designing a simple form. I only have three tables in the database. First Table: tblExpense Columns: ExpenseID ;...
6
by: MP | last post by:
Hello I want to have a public property (and Brows able) in one control, I use this code: public System.Windows.Forms.Form recordForm get { return _recordForm;} set {_recordForm = value;}
5
by: ortaias | last post by:
I have a form which calls up a second form for purposes of data entry. When closing the data entry form and returning to the main form, things don't work as expected. When I return to the main...
2
by: ponyeyes | last post by:
Hi There, I am a bit of a newbie to PHP programming and I would like to know how I can place a selected drop down option into a PHP variable and then produce an sql query which incorporates this...
1
by: abTech | last post by:
Have struggled a lot to get a filtered drop down in the normal html and that too editable ... i have used table like auto-completion etc ... This is the simplest solution for a filtered drop down ...
106
by: bonneylake | last post by:
Hey Everyone, Well i don't know if my question should be in javascript/ajax or coldfusion, i figure this is more of a coldfusion question. But if this is in the wrong section let me know an all...
61
by: bonneylake | last post by:
Hey Everyone, Well after asking many questions i have this almost working. This is how it works. Basically i fill in my customer number field an that populates my drop down box. Once i select...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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...
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...
0
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,...
0
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...

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.