Solved

Updating form using DBComboBox

Posted on 1998-11-17
4
374 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

773 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