Solved

how to set a default value on datacombo

Posted on 2000-03-09
5
214 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 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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 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…
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…

770 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