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

Combo box requery

I have a form with 2 combo boxes in it. The first combo box is named combo0 and has as its row source:

SELECT DISTINCT [tsam grouped]!field1 FROM [tsam grouped] ORDER BY [field1];

The second combo box has as its row source:

SELECT DISTINCT [TSAM GROUPED]!field2AS Expr1 FROM [TSAM GROUPED] WHERE ((([TSAM GROUPED].field1)=Forms!form1!combo0));

So basically, the user selects from the first combo box which field1 value they want to limit their returned recordset to. Then the second combo box populates with all unique field2 values for that field1 selection.

My problem is this: This form works only one time, and then the second combo box does not change based on what is entered in the first combobox. I *think* I have this narrowed down to having to do something to the On Get Focus property of the second combo box, but I'm not sure what that is. I just need for the second combo box to recalculate each time the first combo box is changed.

It is quite unfortunate that this form will need to be run more than one time in the history of the universe. Otherwise I would be done with this part already :-)Can anyone help?

Thanks in advance!
Jan 24 '07 #1
7 1592
P.S.

Here's what I've tried: Any number of variations of Me!Combo2.requery in On Get Focus Property. (The second combo box is Combo2)

Thanks!
Jan 24 '07 #2
Nevermind, I got it. Just had to do a module in the On get Focus:
Me!Combo2.Requery.

Blah.
Jan 24 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
Nevermind, I got it. Just had to do a module in the On get Focus:
Me!Combo2.Requery.

Blah.
You could also use the Me!Combo2.Requery in the After Update event of Combo0.

Glad you got it to work anyway.

Mary
Jan 25 '07 #4
NeoPa
32,556 Expert Mod 16PB
Well done for finding a solution, but don't feel bad about posting.
Mary's answer is an illustration of the correct way of doing it. Your way will have the desired effect but may also cause it to run the code more often than it needs to.
This really should be run only when a selection is made in Combo0.
Jan 25 '07 #5
NeoPa
32,556 Expert Mod 16PB
You may find this helps too (Example Filtering on a Form).
Jan 25 '07 #6
Mary/NeoPa,

Your afterupdate solution in the first combo box causes the 2nd combo box to populate much, much faster than the ongotfocus (on the 2nd combo box) way I was trying.

Thanks!
Jan 26 '07 #7
NeoPa
32,556 Expert Mod 16PB
We're glad we were able to help :)
Jan 26 '07 #8

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

Similar topics

1
by: Robert Neville | last post by:
The solution to my dilemma seems straight-forward, yet my mind has not been forthcoming with a direct route. My Project form has a tab control with multiple sub-forms; these distinct sub-forms...
2
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would...
1
by: Donna Sabol | last post by:
I have a form (frm_MAIN_RPT) that contains a combo box (Combo6) & subform (dbo_REQ_subform). The combo box is used to select the "cost center" data that will be displayed in the subform. From...
3
by: mal | last post by:
Sorry for repost - system added to another subject for some reason Have tried numerous ideas from the group to solve this one. It is such a simple example that it should be straightforward ! I...
2
by: Lucinda Roebuck | last post by:
I'm using Access 97 on a Windows XP computer. The combo box on the form "form1" will not refresh after a new name is added to the list. The "limit to list" properties for the combo box is set to...
3
by: dmkeith2 | last post by:
I have a table for all my combox boxes. ID: AutoNumber ComboName: text ComboValue: text with no duplicates I have create a query based on this table. I have also created two forms based on...
1
by: Bill | last post by:
Problem: Combo box data disappears from view when a requery is done See "Background" below for details on tables, forms & controls On a form, I want to use the setting of bound combo box C1...
5
by: consonanza | last post by:
I am working on a report filter form. It has 2 combo boxes (cmboSelectSubject and cmboSelectCategory) to select criteria. Selecting an entry in combo 1 restricts the options available in combo 2....
12
waynetheengineer
by: waynetheengineer | last post by:
Hi, I have a combo box on a form with a list of cities in it based on a single field city table. I also have a command button on this form that opens up another form that allows the user to enter...
13
by: mirandacascade | last post by:
I want to set things up such that a section of code will have been executed by the time one clicks on the drop down arrow on a combo box control. Currently, that section of code resides in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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?
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
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
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...

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.