Solved

DB Combo Box

Posted on 1998-11-18
3
179 Views
Last Modified: 2010-05-03
I must use a DBCombo box as part of my current project.  I am wanting to select a cutomer's name from the dbc and have the corresponding information from my table be loaded into text boxes.
0
Comment
Question by:adgarrison
  • 2
3 Comments
 
LVL 2

Expert Comment

by:dabellei
ID: 1445529
Use a recordset with data control and do a seek or find in your recordset.  Or just do an SQL search when the content of the DBCombox change.
0
 

Author Comment

by:adgarrison
ID: 1445530
That does not answer my question at all.  If I do not know how to start on this, it would stand to reason that I would not know what the code would be. Thanks for you help anyway.
0
 
LVL 2

Accepted Solution

by:
dabellei earned 50 total points
ID: 1445531
Here'S a sample code


Sub fill_fields()
    Data1.RecordSource = "select *from users where usercode = '" & DBCombo1.Text & "'"
    Data1.Refresh
    On Error Resume Next
    Text1.Text = Data1.Recordset.Fields("username")
    Text2.Text = Data1.Recordset.Fields("serveur")
   
End Sub


Private Sub DBCombo1_Change()
    Call fill_fields
   
End Sub

Private Sub DBCombo1_Click(Area As Integer)
    Call fill_fields
End Sub



You need two data control
1 for recordset with information
      Database set to a valid database
      recordsource set to a valid table

1 for the filling of the dbcombo with selection data
      Database set to a valid database
      recordsource set to a valid table
     
1 dbcombo
      rowsource set to data2
      listfields set to a valid field

2 text box


The dbcombo will be fill with the usercode in this case
When the user click on dbcombo the dbcombo will show all user code from database

When an entry is select then the data1 recordset will be set to the record wich contain all fields from the table that correspond to the entry in the dbcombo.

Hope this will be more comprehensive an answer your question.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

821 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