Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Box Where Condition

Status
Not open for further replies.
Apr 26, 2005
29
US
Hello,

I cannot figure out why the list box I built on my form does not enter the criteria needed for my "where condition". Here is my setup.

I have a query with 4 columns which list product information. I then built a report off this query to display the information in a certain format. From here I created a form which has a list box populated by the original query. When the list box was created I marked the column which I wanted as "bound" and then created a command button which runs a macro. The macro is setup to open the report in print preview based on the bound column in the list box (The where condition formula is [Fieldname]=[Forms]![FormName]![ListBox].[BoundColumn]).

When I run the macro independently it requests the parameter value from the bound column in the list box which I key in, then the designated information is displayed in the report. When I highlight an item in the list box and click the command button, the macro runs and returns a blank page in print preview. Is there a command or criteria somewhere else that I am missing?

Thank you
 
Hi, Parabolic33,

My first recommendation is to scrap the macro and use VBA instead. VBA offers much better control, debugging and error handling.

Next, a vital element - is your listbox multi-select?

Ken S.
 
Hi Ken,

Thank you for the advice, the only problem is I have know idea where to start with VBA.

As far the multi-select, yes, it is marked as extended. Any other ideas I could try?

thanks,
Mike
 
Hi Mike!

The multi-select is the problem. A multi-select list box's value will always be null. To set a where condition form this type of list box you need to use VBA.



Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top