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.
Hi again,
I know how to fill the combobox but I need some example of code to
read/write to the winregistry in this case to read the list of DSNs it was
not easy to understand from the http://www.thescarms.com/vbasic/registry.asp
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.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.