Solved

DB Combo Box

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

738 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