473,795 Members | 2,974 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 #1
13 2872
I would have expected #2 to work. #1 will work, but you have to issue a
Requery to the second combo box. In #2, since you are changing the
RowSource, the combo box should automatically requery.

Example:
Me.OtherCombo.R equery

One possible problem, if the combo box has the same name as the field it is
bound to, your code is a little ambiguous. Try changing #2 to

Me.OtherCombo.R owSource = "Select AttendYear from YourTableName Where
YourTableName.E vent = " & Me.ThisComboNam e & ";"

Also, what is the value being returned by Me.ThisComboNam e? Is it a number
or a text string? The syntax is correct for a number, if it is a text
string, modify the above line to:

Me.OtherCombo.R owSource = "Select AttendYear from YourTableName Where
YourTableName.E vent = """ & Me.ThisComboNam e & """;"

--
Wayne Morgan
MS Access MVP
<me***********@ gmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
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 #2
Wayne & Group,

I tried your solution again. The error I get says that it can't find
the macro that I'm using to get the data. The error I think is what's
confusing me because I didn't think I was using a macro. Thanks for
your help,

Melih

Wayne Morgan wrote:
I would have expected #2 to work. #1 will work, but you have to issue a
Requery to the second combo box. In #2, since you are changing the
RowSource, the combo box should automatically requery.

Example:
Me.OtherCombo.R equery

One possible problem, if the combo box has the same name as the field it is
bound to, your code is a little ambiguous. Try changing #2 to

Me.OtherCombo.R owSource = "Select AttendYear from YourTableName Where
YourTableName.E vent = " & Me.ThisComboNam e & ";"

Also, what is the value being returned by Me.ThisComboNam e? Is it a number
or a text string? The syntax is correct for a number, if it is a text
string, modify the above line to:

Me.OtherCombo.R owSource = "Select AttendYear from YourTableName Where
YourTableName.E vent = """ & Me.ThisComboNam e & """;"

--
Wayne Morgan
MS Access MVP
<me***********@ gmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
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 #3
Wayne & Group,

I tried your solution again. The error I get says that it can't find
the macro that I'm using to get the data. The error I think is what's
confusing me because I didn't think I was using a macro. Thanks for
your help,

Melih

Wayne Morgan wrote:
I would have expected #2 to work. #1 will work, but you have to issue a
Requery to the second combo box. In #2, since you are changing the
RowSource, the combo box should automatically requery.

Example:
Me.OtherCombo.R equery

One possible problem, if the combo box has the same name as the field it is
bound to, your code is a little ambiguous. Try changing #2 to

Me.OtherCombo.R owSource = "Select AttendYear from YourTableName Where
YourTableName.E vent = " & Me.ThisComboNam e & ";"

Also, what is the value being returned by Me.ThisComboNam e? Is it a number
or a text string? The syntax is correct for a number, if it is a text
string, modify the above line to:

Me.OtherCombo.R owSource = "Select AttendYear from YourTableName Where
YourTableName.E vent = """ & Me.ThisComboNam e & """;"

--
Wayne Morgan
MS Access MVP
<me***********@ gmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
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 #4
Also, is Me the equivalent to this in an object-oriented language? Or
should Me be something that I've already created?

Melih

Nov 13 '05 #5
Also, is Me the equivalent to this in an object-oriented language? Or
should Me be something that I've already created?

Melih

Nov 13 '05 #6
I'm not familiar with "this". "Me" is shorthand for the form or report on
which the code is running. 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 .

--
Wayne Morgan
MS Access MVP
<me***********@ gmail.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Also, is Me the equivalent to this in an object-oriented language? Or
should Me be something that I've already created?

Melih

Nov 13 '05 #7
Please post the entire On Exit event from the VBA editor. Also, in the
form's Properties sheet, the On Exit should be set to [Event Procedure],
next click the ... button to the right to open the VBA editor at this event.
The first and last line of the event will already be filled in for you.

--
Wayne Morgan
MS Access MVP
<me***********@ gmail.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
Wayne & Group,

I tried your solution again. The error I get says that it can't find
the macro that I'm using to get the data. The error I think is what's
confusing me because I didn't think I was using a macro. Thanks for
your help,

Melih

Wayne Morgan wrote:
I would have expected #2 to work. #1 will work, but you have to issue a
Requery to the second combo box. In #2, since you are changing the
RowSource, the combo box should automatically requery.

Example:
Me.OtherCombo.R equery

One possible problem, if the combo box has the same name as the field it
is
bound to, your code is a little ambiguous. Try changing #2 to

Me.OtherCombo.R owSource = "Select AttendYear from YourTableName Where
YourTableName.E vent = " & Me.ThisComboNam e & ";"

Also, what is the value being returned by Me.ThisComboNam e? Is it a
number
or a text string? The syntax is correct for a number, if it is a text
string, modify the above line to:

Me.OtherCombo.R owSource = "Select AttendYear from YourTableName Where
YourTableName.E vent = """ & Me.ThisComboNam e & """;"

--
Wayne Morgan
MS Access MVP
<me***********@ gmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
> 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 #8
I'm not familiar with "this". "Me" is shorthand for the form or report on
which the code is running. 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 .

--
Wayne Morgan
MS Access MVP
<me***********@ gmail.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Also, is Me the equivalent to this in an object-oriented language? Or
should Me be something that I've already created?

Melih

Nov 13 '05 #9
Please post the entire On Exit event from the VBA editor. Also, in the
form's Properties sheet, the On Exit should be set to [Event Procedure],
next click the ... button to the right to open the VBA editor at this event.
The first and last line of the event will already be filled in for you.

--
Wayne Morgan
MS Access MVP
<me***********@ gmail.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
Wayne & Group,

I tried your solution again. The error I get says that it can't find
the macro that I'm using to get the data. The error I think is what's
confusing me because I didn't think I was using a macro. Thanks for
your help,

Melih

Wayne Morgan wrote:
I would have expected #2 to work. #1 will work, but you have to issue a
Requery to the second combo box. In #2, since you are changing the
RowSource, the combo box should automatically requery.

Example:
Me.OtherCombo.R equery

One possible problem, if the combo box has the same name as the field it
is
bound to, your code is a little ambiguous. Try changing #2 to

Me.OtherCombo.R owSource = "Select AttendYear from YourTableName Where
YourTableName.E vent = " & Me.ThisComboNam e & ";"

Also, what is the value being returned by Me.ThisComboNam e? Is it a
number
or a text string? The syntax is correct for a number, if it is a text
string, modify the above line to:

Me.OtherCombo.R owSource = "Select AttendYear from YourTableName Where
YourTableName.E vent = """ & Me.ThisComboNam e & """;"

--
Wayne Morgan
MS Access MVP
<me***********@ gmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
> 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 #10

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

Similar topics

2
2591
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
1775
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
1530
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
2657
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
4645
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
9519
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
10215
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...
1
10165
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9043
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
7541
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...
0
5437
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
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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
3
2920
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.