Solved

DB Combo Box

Posted on 1998-11-18
3
170 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

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…

707 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

15 Experts available now in Live!

Get 1:1 Help Now