Solved

how to set a default value on datacombo

Posted on 2000-03-09
5
221 Views
Last Modified: 2013-12-25
i want to display a paricular name in the datacombo control by default from the list,without the user using it
for ex:the datacombo is having the title"oranges" on it by default,without the user clicking the combo
emoreau(hope i spelt it right) help me
refered by bindu10
thanks
0
Comment
Question by:jacobg12
[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
  • 4
5 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2604540
You can simply set its Text property.

DataCombo1.Text = "oranges"
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2607667
Is this what you wanted?
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 10 total points
ID: 2631194
You have to accept it now if it is working!
0
 

Author Comment

by:jacobg12
ID: 2633282
emoreau ,its not working little busy off late
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2633361
Yes it is!

Place an ADODC control, a DataCombo control, a TextBox and a command button control on a form (without changing any properties). Then paste this code to your form (Do not forget to change the path to the Nwind database):

Option Explicit

Private Sub Command1_Click()
    DataCombo1.Text = Text1.Text
End Sub

Private Sub Form_Load()
    With Adodc1
        .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Files\Microsoft Visual Studio\VB98\Nwind2000.mdb;Persist Security Info=False"
        .RecordSource = "SELECT * From Categories"
        .Refresh
    End With
   
    With DataCombo1
        Set .RowSource = Adodc1.Recordset
        .ListField = "CategoryName"
    End With
   
    Text1.Text = "Confections"
End Sub
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

734 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