How to fill a combobox with DSNs with are stored

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Help with filling a combo box with Data source names stored at a local disc.
thanks in advance
 
System DSNs are in stored in the registry under
HKLM\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources, User DSNs are under
HKCU\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources

It's relatively straightforward to get code to read from the registry (see,
for example, http://www.thescarms.com/vbasic/registry.asp) Once you have the
list of possible DSNs, you can either concatenate them together and use that
concatenated string as the RowSource for the combobox or (more likely, since
the RowSource property has a relatively small size restriction on it) create
a call-back function that you can use to populate the combobox. See
http://msdn.microsoft.com/library/en-us/vbaac10/html/acproRowSourceTypeFunctionParameters.asp
for details about the call-back function.
 
Download the source code, get the .BAS file from the download, open it in
Notepad and copy all of the code into a module.

You need to use the fEnumValue function from that module: I don't have the
code handy, but I believe the results are stored in the 3rd parameter.
 
Back
Top