Unbound combobox sending Null to query

Dartagnan

Active Member
Joined
Jun 19, 2002
Messages
386
My unbound combobox is based on query and shows cities. I am trying to send this value to a query used by a report. I keep getting no records. Finally I tried the following iif statement and determined the value being passed is null because I do get records when I use this as the criteria.

IIf(IsNull([forms]![frmReports]![cboCity]),"Anza","No")

Any thoughts?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Are you saying the combobox is empty when this happens? Why not choose a city, in that case so it won't be empty?
 
Upvote 0
No there are values in the combobox and I am selecting a value. Ultimately I want to be able to select more than one.
 
Upvote 0
I guess you should explain how the query works. If the combobox is not empty, the problem is somewhere in how you are sending the value to the report.

Edit:
Or maybe you are incorrectly reading/referencing the combobox.
 
Last edited:
Upvote 0
Funny I have not had this problem until 2010. Form name is frmReports. Combobox = cbocity. Once a city is selected the user clicks View to open the "rptCityToWorkIn" report. The reports query has several columns but only one criteria which is [forms]![frmReports]![cboCity].
 
Upvote 0
I see. Well that is the way I would have recommended you to set this up.

I take it you changed the criteria in the report query source to something like this (and then it works):
Nz([forms]![frmReports]![cboCity],'Anza')

You said you wanted to change the combobox to be able to pick more than one city. Is it possible the combobox is now in some kind of multi-select mode. What you have here, with the use of the combobox in a query criteria, would require the combobox to be single select (I'm ignoring the possibility of multi-valued fields which I know nothing about anyway).
 
Upvote 0

Forum statistics

Threads
1,221,889
Messages
6,162,627
Members
451,778
Latest member
ragananthony7911

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top