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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBCombo Box Trouble

Status
Not open for further replies.

ranshe

Programmer
Oct 5, 2004
27
0
0
US
I am trying to use a DBCombo box.
It reads a Access.mdb table with only one field.

It works fine when I bind it to a Data ocx object on the form. It works fine, that is, as long as I set the Properties of the Data ocx object to:

DatabaseName = Access.mdb full path (Ex. C:\etc.)
DefaultCursorType = DefaultCursor
DefaultType = UseJet

This is not what I need.
What I need to do is access the Access.mdb via ODBC but when I set the Properties of the Data ocx object to:

DatabaseName = the ODBC name
DefaultCursorType = ODBCCursor
DefaultType = UseODBC

It does strange things. It displays only the first letter of the field in the DBCombo box and it loses the drop down list.

I need to use the ODBC cannection, any advice?

Thanks!

 
First create an ODBC System dsn source for your database.

You want to use the DataCombo list in tandem with the ADO Control instead. Set Project Components to the Microsoft ADO Data Control as well as the Microsoft DataList Controls. Drag the ADO Data control to the form and set it's properties...right-click the control and select ADODC properties...Select the option for ODBC DataSource name. Go to the RecordSource tab and select the table you want to bind to or sql statement. Then in the DataCombo set the DataSource and RowSource to the ADO control. Set the ListField, BoundColumn and DataField properties.

The old Data control is more there for backward compatibility. There's no real reason to use it now.
 
I have tried the above and it works well for a DataList and the DataCombo but not for the DBCombo .
With the DBCombo I get the message when I try to fill out the RowSource:
"No compatible data source found for this control. Please add an intrinsic Data Control or a Remote Data Control to the form."
I can use the DataCombo but now I am curious as to why it wont work on the DBCombo.
 
DataCombo is a control that's designed to be bound to the ADO Data control. DBCombo is designed to be bound to either the intrinsic Data Control (i. e. the data control you don't have to set a reference to) or the Remote Data Control. If you don't want the DBCombo to do strange things when using ODBC, then bind it to a Remote Data Control.

However, imterpsfan3's advice is best. The other stuff is yesterday's news.

Personally, I don't use data controls of any kind, however; I prefer to manually bind to ADO recordsets. I'd rather spend my time figuring out what's going on in my own head than in someone else's.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top