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

dependent combo boxes, behavior when choosing blank space

Hi,

I have a search form and 2 important comboboxes(CB)in it, where by selecting option1 or option2 in CB1, i get offered different data in CB2.

here's what i have:
In CB2 i added criteria:
Expand|Select|Wrap|Line Numbers
  1. [Forms]![myformname]![CB1name]
and in AfterUpdate of CB1 I made a Macro "Requery" with Control name: CB2name

And it works fine.

but the problem is, when i dont select anything in CB1, i dont have any data in CB2. So, instead of empty CB2, i would like to have both(all) data in it.

any idea how can i do that? What code to include?

Thank you so much
Jan 8 '16 #1

✓ answered by mbizup

Another option is to use LIKE in the criteria:

Expand|Select|Wrap|Line Numbers
  1. LIKE  NZ([Forms]![myformname]![CB1name], '*')
The wildcard (*) will return everything if CB1name is blank/null.

5 1096
jforbes
1,107 Expert 1GB
Replacing:
Expand|Select|Wrap|Line Numbers
  1. [Forms]![myformname]![CB1name]
with:
Expand|Select|Wrap|Line Numbers
  1. [Forms]![myformname]![CB1name] OR NZ([Forms]![myformname]![CB1name], '')=''
will probably work. Query criteria gets evaluated to down to a Boolean of True or False, so just include a value that forces the Criteria to evaluate to True when there isn't a value supplied for your ComboBox. There is a lot of flexibility when going about this and the above is just one of the ways to do this type of thing. If you are still stuck after attempting this, post the entire RowSource for the ComboBox and we can get you sorted out.
Jan 8 '16 #2
mbizup
80 64KB
Another option is to use LIKE in the criteria:

Expand|Select|Wrap|Line Numbers
  1. LIKE  NZ([Forms]![myformname]![CB1name], '*')
The wildcard (*) will return everything if CB1name is blank/null.
Jan 8 '16 #3
Thanks, both of codes works so far.

I was planning to make that form as subform in tabbed navigation form. When selecting those two combo boxes in navigation form I get Enter parameter value warning: "Forms!myformname!CB1name".
Other combo boxes (not dependent) work fine.
Jan 11 '16 #4
jforbes
1,107 Expert 1GB
I don't have any experience with the Navigation Form, but a few other Experts on this site do.

I remember seeing this post, maybe it will help you: https://bytes.com/topic/access/answe...ntrol-subforms
Jan 11 '16 #5
Okay, thanks for help.
Jan 12 '16 #6

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

Similar topics

1
by: me | last post by:
I would like to put 4 combo boxes on a user form, each one limiting the results to the set from the previous combo box. Can anyone please offer some guidance ? Thanks ! Please answer here in...
10
by: lorirobn | last post by:
Hi, I have a form with several combo boxes, continuous form format, with record source a query off an Item Table. The fields are Category, Subcategory, and Color. I am displaying descriptions,...
9
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
4
by: Miguel | last post by:
I have an order entry database with two forms. One is for new orders the other is to update orders. The forms are identical except that one is strictly order entry. On both forms are three sets of...
5
by: debbie | last post by:
I have three combo boxes on a subform. I have tried setting them up so that when the user clicks in the combo box the curser moves to the left. I have searched the posts and can find nothing that...
4
by: deanndra | last post by:
First, I want to say thank you to Scott and the others who replied to my first post here. I had to put that database on hold for the moment when I was tasked with a new one. I am building another...
3
by: hominamad | last post by:
Hi, I am trying to come up with a solution to the following scenario: I have a continuous form on which two of the fields are "Transaction Type" and "Sub Transaction Type". When the user...
1
by: bkholloway | last post by:
hello...first time here...have an access 07 db and need to have multiple dependent combo boxes. I have a little experience using expression builder but not VBA...basically need to limit choices in...
1
by: Randey | last post by:
."}] I have a table that I need to recall certain data according to what I use in a form filter that uses several combo boxes. If the combo box is empty then I want to recall all the data...
10
by: jss787 | last post by:
Let me start by saying this is my first database. The problem I am having is I have 7 combo boxes on a form that are dependent on each other and only two of them are diplaying unique values. The rest...
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
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
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
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,...

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.