That worked. Thank you.
Main Topics
Browse All TopicsUsing MS query through excel 2007 to query a SQL database and return a table. I've named the first 2 columns of the table for the dynamic range of a combobox. I've started with a small group to test everything, the maximum table height is 13 cells. All 13 rows are pulled into the table as the worksheet sheet opens and all 13 rows show up as selections in the combobox. The table is recreated based on changes into cell A1. When I restart the query and bring back less rows, four for example, the combobox correctly displays the 4 rows. When I requery the database in such a way that would bring back more than 4 rows, only the first four rows are displayed in the combobox without the ability to scroll and pick up any other values.
Query:
SELECT OITM.ItemCode, OITM.ItemName, OITM.ItmsGrpCod, OITB.ItmsGrpNam
FROM FSDBDV.dbo.OITB OITB, FSDBDV.dbo.OITM OITM
WHERE OITB.ItmsGrpCod = OITM.ItmsGrpCod AND ((OITM.ItemCode Like ?) AND (OITB.ItmsGrpNam='MEQUIP')
with parameter of :
Get the Value from the following cell = Sheet1$A$1
and refresh automatically when cell value changes
The resulting table starts in cell C1
I have two named ranges both of which result in the same action from the combobox
CellCount = =OFFSET(Sheet1!$C$2,0,0,CO
or
ItemCodeQuery = =Table_Query_from_DEV_NIAC
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: folderolPosted on 2009-11-05 at 21:14:49ID: 25756743
After my testing, you have two choices.
ess
Refresh your query with a macro and use either code, for a dynamic named range called CB_fillrange. For some reason, if you only restate the listfillrange like in the first choice, you have to set the refresh backgroundquery to false. I would not refresh in the background in any case, but my query is really fast and only the .address syntax will keep the combobox properly filled if False isn't specified.
lo.QueryTable.Refresh False
cb.ListFillRange = ""
cb.ListFillRange = "CB_fillrange"
OR
lo.QueryTable.Refresh
cb.ListFillRange = Range("CB_fillrange").Addr
Select allOpen in new window