Solved

Updating form using DBComboBox

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

840 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