Solved

Updating form using DBComboBox

Posted on 1998-11-17
4
372 Views
Last Modified: 2013-12-25
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!
0
Comment
Question by:MTroutwine
4 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1488337
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
0
 
LVL 3

Author Comment

by:MTroutwine
ID: 1488338
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,

0
 
LVL 12

Expert Comment

by:jgv
ID: 1488339
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
0
 
LVL 2

Accepted Solution

by:
cedricd earned 100 total points
ID: 1488340
use a data control
events :
private sub dbcombo1_click(area as integer)
        if area = 2 then
           data1.recordset.findfirst("id ='"+dbcombo1.boundtext+"'")
           textbox1.text = data1.recordset(1)
           etc...
        end if
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now