Reputation: 167
In Access 2007, I have a listbox that is filtered by 4 comboboxes. Once the filter is set, some fields in the listbox are completely empty. Is there some way I can programmatically hide those fields? I know that it's possible to manually set field widths to 0, but that's not really viable in this case. Here is a snippet of the code; it is from the AfterUpdate event of one of the comboboxes. I'm not really sure what code is needed for anyone to help with this.
Me.OutTable.RowSource = "SELECT * " & _
"FROM FinalTable " & _
"WHERE [ID Maker.Axis] = '" & Me.Axis.Value & "' " & _
"AND [ID Maker.Test Type] = '" & TestType.Value & "' " & _
"AND [ID Maker.Billet Number] = " & BilletNumber.Value & " " & _
"AND [ID Maker.Billet Material] = '" & BilletMaterial.Value & "' "
Upvotes: 1
Views: 363
Reputation: 7019
You are using SELECT *
on a query that is not organized at the column level as you need it to be.
Try selecting for display only the 1-3 fields you are sure you'll want as columns in the listbox -- hopefully fields that always have a value. (If you want more than 1-3 columns, try a small number just to get started.)
The right starting place may be re-organizing your "mash-up" query result. Maybe you are using a UNION query, but it seems unlikely -- The UNION query has a funny way way of forcing you to think through your requirements. You may want to try it.
I believe as you get coherent results on your query, the listbox may resolve itself. To get more help with that, post information about your table structures and content. It may deserve a separate post.
Upvotes: 2