Link to home
Start Free TrialLog in
Avatar of MTroutwine
MTroutwineFlag for United States of America

asked on

Updating form using DBComboBox

I have an application where I have created a Data Environment, Connection and Commands from a SQL database.  The form has several numerous textboxes that are bound to the this data environment.  I have added a DBComboBox and I am able to fill it with the 'Name' field, I have the BoundColumn set to the 'ID' as it is the Primary Key in the database.  When I change the selection in the combobox I want all of the fields to update with the new selection.  So far I haven't been able to do this.  I have tried using the recordsets Move, Bookmark and some other combinations and I am having no luck.  I am sure I am missing something here.  Help!
Avatar of Mirkwood
Mirkwood

Fill in the listfield and datafield  property of the DBCombo1

set Dbcombo1.datasource = data1
DbCombo1.Datafield = "Author"
DbCombo1.ListField = "Author"
DbCombo1.matchentry = 1
DbCombo1.style = 2
Avatar of MTroutwine

ASKER

I am able to fill the combobox, what I am looking for is when you change the selection in the combobox updating all of the other textboxes on the same form with the current recordset.  What is happening now is I change the combobox selection and it doesn't update the form.  I am using VB6, I am setting the DataCombo properties of DataSource, DataMember, DataField, RowSource, RowMember, ListField and BoundColumn.  I have setup a Data Environment with one connection and one command.  I tried using DataCombo1.SelectedItem and I get error messages that the columns have not been modified no changes are made closing application.  Hope this helps, sorry for such poor detail before.
Thanks,

Try this:

Private Sub DBCombo1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
searchstring = "NAME = '" & DBCombo1.Text & "'"
Data1.Recordset.FindFirst searchstring
End Sub
ASKER CERTIFIED SOLUTION
Avatar of cedricd
cedricd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial