Solved

how to set a default value on datacombo

Posted on 2000-03-09
5
209 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
  • 4
5 Comments
 
LVL 69

Expert Comment

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

DataCombo1.Text = "oranges"
0
 
LVL 69

Expert Comment

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

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 69

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

708 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

13 Experts available now in Live!

Get 1:1 Help Now