ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populate Drop-Down from Database Using VBA (https://www.excelbanter.com/excel-programming/279657-populate-drop-down-database-using-vba.html)

Nuggets

Populate Drop-Down from Database Using VBA
 
Populate Drop-Down from Database Using VBA

Hello,
I have a spreadsheet with 4 drop-down boxes. On open, I
would like to populate these 4 drop-down boxes with
results returned from a database query (SQL Server 2000).

Is this possible?

I've used VBA and ADO 'behind' the sheet to open a
database connection, execute a query, and return the
results, but I can't figure out now how to stick the
result set into the drop-down box.

Does anyone know how to do this?

Thanks.


Tom Ogilvy

Populate Drop-Down from Database Using VBA
 
combobox1.List = Application.Transpose(rs)

would be the first thing I tried.

--
Regards,
Tom Ogilvy

"Nuggets" wrote in message
...
Populate Drop-Down from Database Using VBA

Hello,
I have a spreadsheet with 4 drop-down boxes. On open, I
would like to populate these 4 drop-down boxes with
results returned from a database query (SQL Server 2000).

Is this possible?

I've used VBA and ADO 'behind' the sheet to open a
database connection, execute a query, and return the
results, but I can't figure out now how to stick the
result set into the drop-down box.

Does anyone know how to do this?

Thanks.





All times are GMT +1. The time now is 11:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com