Solved

DB Combo Box

Posted on 1998-11-18
3
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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.
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…
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…
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…

691 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