473,804 Members | 3,203 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populating One Dropdown based on the Results of Another

Group,

I'm having a tough time understanding some of the previous posts on
this topic so I wanted to write what I've tried and hope that you can
help me troubleshoot. I have a dropdown populated from a table and I
want to take that selection and use it to populate the next dropdown.
So far:

1) I tried using a query that said select specificissue from
specific_issue and used as my criterion [Form]![Report]![IssueCategory]
but that didn't seem to populate the 2nd dropdown. (Rowsource type was
query)

2) I tried on the On Exit command of the first combo box to use this
statement to populate the second combo box
([OtherCombo].RowSource = "Select AttendYear from YourTableName Where
YourTableName.E vent = " & Me.ThisComboNam e)

3)I've also clicked every button in Access

All help will be appreciated,

Thanks in advance,
Melih

Nov 13 '05
13 2875
"Wayne Morgan" <co************ *************** @hotmail.com> wrote in
news:8g******** ********@newssv r19.news.prodig y.com:
I'm not familiar with "this". "Me" is shorthand for the form or
report on which the code is running. . . .
Actually, I think "Me" refers to the class object you're working in.
That's why it works in a standalone class module, since it's a class
object that's unattached to a form or report.
. . . If the form is called
frmMyForm, you would refer to it as Forms!frmMyForm . However, if
the code is in the frmMyForm's module, you can simply say Me
instead of Forms!frmMyForm .


Likewise, when you need to write modular code to act on multiple
forms, you can use the Me keyword to pass a form reference to the
external code. If your external code works like this:

Public Sub SetUpForm(frm As Form)
frm.Detail(0).B ackGroundColor = 0
[and so forth]
End Sub

You'd call it in the form as:

Call SetupForm(Me)

or simply:

SetupForm Me

(I prefer to use Call to show that it's a call to external code, not
a standalone Access command)

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #11
"Wayne Morgan" <co************ *************** @hotmail.com> wrote in
news:8g******** ********@newssv r19.news.prodig y.com:
I'm not familiar with "this". "Me" is shorthand for the form or
report on which the code is running. . . .
Actually, I think "Me" refers to the class object you're working in.
That's why it works in a standalone class module, since it's a class
object that's unattached to a form or report.
. . . If the form is called
frmMyForm, you would refer to it as Forms!frmMyForm . However, if
the code is in the frmMyForm's module, you can simply say Me
instead of Forms!frmMyForm .


Likewise, when you need to write modular code to act on multiple
forms, you can use the Me keyword to pass a form reference to the
external code. If your external code works like this:

Public Sub SetUpForm(frm As Form)
frm.Detail(0).B ackGroundColor = 0
[and so forth]
End Sub

You'd call it in the form as:

Call SetupForm(Me)

or simply:

SetupForm Me

(I prefer to use Call to show that it's a call to external code, not
a standalone Access command)

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #12

me***********@g mail.com wrote:
Group,

I'm having a tough time understanding some of the previous posts on
this topic so I wanted to write what I've tried and hope that you can
help me troubleshoot. I have a dropdown populated from a table and I
want to take that selection and use it to populate the next dropdown.
So far:

1) I tried using a query that said select specificissue from
specific_iss ue and used as my criterion [Form]![Report]![IssueCategory]
but that didn't seem to populate the 2nd dropdown. (Rowsource type was
query)

2) I tried on the On Exit command of the first combo box to use this
statement to populate the second combo box
([OtherCombo].RowSource = "Select AttendYear from YourTableName Where
YourTableName. Event = " & Me.ThisComboNam e)

3)I've also clicked every button in Access

All help will be appreciated,

Thanks in advance,
Melih


You have a dropdown where you select a specific field and want to use it to
populate the next dropdown?
1) Your first dropdown should be unbound, and should have a name (go to
properties, other, name).

2) create a second dropdown also unbound, make sure to include the field that
you are selecting in the first dropdown. Also should have a name.
go to propereties and in RowSource click on ... (ellipses).
under the field selected in the first dropdown: Criteria:[first
dropdown name].[value]

3) Make a Macro: RequerySecondDr opdown. Action: Requery

Control Name: Second Dropdown Name

4) First Dropdown go to properties: Event: OnClick: RequerySecondDr opdown

I hope this help Mehli, Good luck
--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200507/1
Nov 13 '05 #13

me***********@g mail.com wrote:
Group,

I'm having a tough time understanding some of the previous posts on
this topic so I wanted to write what I've tried and hope that you can
help me troubleshoot. I have a dropdown populated from a table and I
want to take that selection and use it to populate the next dropdown.
So far:

1) I tried using a query that said select specificissue from
specific_iss ue and used as my criterion [Form]![Report]![IssueCategory]
but that didn't seem to populate the 2nd dropdown. (Rowsource type was
query)

2) I tried on the On Exit command of the first combo box to use this
statement to populate the second combo box
([OtherCombo].RowSource = "Select AttendYear from YourTableName Where
YourTableName. Event = " & Me.ThisComboNam e)

3)I've also clicked every button in Access

All help will be appreciated,

Thanks in advance,
Melih


You have a dropdown where you select a specific field and want to use it to
populate the next dropdown?
1) Your first dropdown should be unbound, and should have a name (go to
properties, other, name).

2) create a second dropdown also unbound, make sure to include the field that
you are selecting in the first dropdown. Also should have a name.
go to propereties and in RowSource click on ... (ellipses).
under the field selected in the first dropdown: Criteria:[first
dropdown name].[value]

3) Make a Macro: RequerySecondDr opdown. Action: Requery

Control Name: Second Dropdown Name

4) First Dropdown go to properties: Event: OnClick: RequerySecondDr opdown

I hope this help Mehli, Good luck
--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200507/1
Nov 13 '05 #14

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

Similar topics

2
2593
by: Lamine Darbouche | last post by:
Can anybody help? I need to have three list boxes automatically populating each other, (ie when region is selected from the first listbox, it will populate automatically the second one which is the TOWNS and when the town is selected is should populate the third one AREA) all data is in the database in one table. Any idea??? Many thanks in adavance. Lamine
4
1722
by: JP SIngh | last post by:
I have three dropdowns in one of my asp page. Each dropdown does return a huge amount of records , 5000 to be precise. The huge amount of data makes the page slower to load and also makes it extermly diffcult for users to choose one value from the list. Does someone have a better solution to implement this? I guess one of the things that I am keen on is to have a textbox (readonly) and a pop up window to allow users to search for a...
3
4065
by: to_rgoyal | last post by:
Hi All, I am creating one web base application using ASP.net and C#. I am populating dropdown lists of my web pages using database. I am using this code: con = new SqlConnection(connectionString); SqlCommand getresult = new SqlCommand("select distinct(owner) from issue_log",con); con.Open();
1
1776
by: Mike P | last post by:
I am populating a drop down column in a datagrid on page load. Here is my code : <asp:TemplateColumn> <ItemTemplate> <asp:DropDownList ID="ddlUserName" Font-Name="Verdana" Font-Size="8pt" Runat=server DataValueField="UserName" DataTextField="UserName" DataSource='<%# GetUserList() %>'>
2
1533
by: Spartaco | last post by:
I have a dropdown control into a page and a gridview, both are associated to two SqlDataSource controls, one of them is used to fill the DropDownControl, that is meant to be a filter over the query of the other SqlDatasource associated to the grid. This works fine, whenever I choose an item in the dropdown combo, I get a filtered grid. I did this using the declarative syntax, without writing any code. ok, now I want to put another item...
4
2658
by: AccessRookie | last post by:
Ok, I am pretty new to Access (Using Access 2002 at my job). Here is what I want to do. I want to create a database that has a form. On this form will be a dropdown menu (combobox). Depending on what you select in the first drop down box, another dropdown box will be populated with specific info based upon what was selected in the first box. For example: The first drop down box has "Breakfast" "Lunch" and "Dinner" as a
0
1706
by: koonda | last post by:
Hi all, I have a Project due after one week. It is a web service project. I have a Web Form which communicates to the web service and this web service communicates to the database. I have all my SQL statements in the Data Acess Layer to create more secure web service application. The Web service class is also in the Data Access Layer. I need to populates the 4 Dropdown list boxes on the web form from one table. I have Customer table which...
11
4647
by: tokcy | last post by:
Hi everyone, I am new in php and ajax, i am facing the prob while i click on element of first drop down then in second dropdown all element showl come from database. I mean i have three dropdown 1. category which comes from database 2. brand which comes from databse according to content of first dropdown . and 3. price which is static. when i am doing these things without ajax on every onChange() thw whole page is refreshing that i do not...
0
9587
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
10588
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
10340
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10085
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
5527
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
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
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
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.