Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO Data Control used for ComboBox

Status
Not open for further replies.

wfweirich

Programmer
Sep 10, 2001
21
US
I am trying to create a form that includes a drop down for record selection. I have added an ADO Data Control to my form because I like what I have read about these vs. other dsn connections. I was able to hide the ADO Data Control and use it to populate a DataCombo control, but when I try to use a click event, my code processes when the down arrow is clicked, not an item in the list. Is this even a good way to approach this or should I be using a more efficient method? I just want to do it right. Thanks in advance for listening. wfw
 
As for what connection type to use, I always use recordsets and populate comboboxes, etc from them. The only exception would be in the case of some variation of a grid control, where I have used the ADO data control. Doesn't mean one's better, I just stick with what works. As for your combobox, use the change event rather than the click event. I wish vb defaulted to the change event when you double-click the control to go to it's code(for the combobox only), but who am I to tell microsoft what to do? Anyways, that's my 2 cents.
 
Your 2 cents is very helpful. Thanks for your quick response. I like code that I can actually get my hands on. Programming with recordsets provides code that can be used over and over. I have done this many times with Access Dbs, but this time I am attempting my first shot at connecting to an SQL Server Db. This will be the first of many, I hope. Thanks again. wfw
 
No reason you can't do it the exact same way. Just need to change your connection string. I am working on a sql server based app now. Here's my connection string:
gconn = "Provider=SQLOLEDB.1;Password=[pass];Persist Security Info=True;User ID=[userid];Initial Catalog=[db name];Data Source=[sql server name]"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top