473,394 Members | 1,865 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,394 software developers and data experts.

How to refresh the second combo box?

17
Hello guys,

i have made a data entry form with two combo boxes.

The first one called [company ID] from the table [company] with the

row source:
Expand|Select|Wrap|Line Numbers
  1. SELECT [company].[company ID], [company].[company name] FROM company;
  2.  
so i don't need to remember the company ID but can see the company name connect to the company ID instead.

the next combo box is called [subs ID] from the table [subsidiary]
( incl. subs ID, company ID, ...),
which populates the combo box with the correct list of subsidiaries of the company chosen in the first combo box.

row source:
Expand|Select|Wrap|Line Numbers
  1. SELECT subsidiary.[subs ID], company.[company ID], subsidiary.[subs name] LEFT JOIN subsidiary ON company.[company ID]=subsidiary.[subs ID] WHERE ((([company].[company ID])=[Forms]![xxx]![company ID]))
  2.  
this works like a charm, but if i accidentally took the wrong company and wanna change that, the subsidiary list in the second combo box remains the same. it doesn't change to the new situation meaning to the new list of subsidiaries of the new company.

how can i refresh or requery the list of the second combo box???
Jul 5 '15 #1

✓ answered by jimatqsi

In the After Update event of [Forms]![xxx]![company ID]) you will want to put this line of code to requery the 2nd combo box:
Expand|Select|Wrap|Line Numbers
  1. Me.[Subs ID].requery
Do yourself a favor and avoid putting spaces in object names in the future. You won't have to bracket [] everything.

Jim

3 2070
jimatqsi
1,271 Expert 1GB
In the After Update event of [Forms]![xxx]![company ID]) you will want to put this line of code to requery the 2nd combo box:
Expand|Select|Wrap|Line Numbers
  1. Me.[Subs ID].requery
Do yourself a favor and avoid putting spaces in object names in the future. You won't have to bracket [] everything.

Jim
Jul 5 '15 #2
rod4
17
Thanks that was the perfect reply! i was so close but then so far! ;)
the spaces problem is the next item on my lists of problems to solve!
thanks a lot!!!
Jul 5 '15 #3
NeoPa
32,556 Expert Mod 16PB
Please understand this is not advice to ignore what Jim's said, but simply an alternative that you should understand.

Access will also make controls with spaces in their names available by replacing those spaces with underscore (_) characters. Thus, Me.Subs_ID is another way to refer to it.

Far better not to have them though, as you've already agreed.
Jul 5 '15 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Alienz | last post by:
Hey, I was reading the google groups for info on this but the explanation left out exactly how to do the query.. Lets say I have table1 with 2 combo boxes combo1 has a value list of: "new",...
15
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting...
0
by: Rosalie Tackett | last post by:
Hello, I need a query that will determine the values in a dropdown box (Module), based on the value chosen in another dropdown box (Dir). SELECT Modules.Module FROM Modules WHERE...
1
by: AA Arens | last post by:
On form 1 I have a button accessing another form 2. Form 1 handles the fill in of compant info starting with choosing a company via combo box. Form 2 is to add another company. When I dismiss...
4
by: jhwa | last post by:
I am a relative newbie to Access. I am creating an inventory and sales database in Access 2007 on Windows XP. I am trying to create two combo boxes on a form, where one is populated with info from...
3
by: mbedford | last post by:
In my asset and employee database I have Departments and Subdepartments. In the forms I want to filter the Subdepartment combo boxes based on the selection in the Department combo box. Combo...
16
by: klbrownie | last post by:
Hello all, I have a subform within a form and I have two combo boxes. the first combo is Facility and the second is Unit. I want the selections for Unit to be determined by the selection in...
5
by: Haagimus | last post by:
I am trying to create an access form that will have multiple combo box drop downs. There are two that will need to be linked in the form. The selection of the first will need to become the query...
6
by: lewisoh | last post by:
I am using Access 2007 trying to use combo box 1 named zone to define which data is shown in combo box 2 named cell. The code is as follows; Private Sub Zone_AfterUpdate() ' Update the row...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...
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...

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.