Solved

MS Forms 2.0 Object Library - ComboBox

Posted on 2000-04-10
8
1,287 Views
Last Modified: 2011-04-14
I was looking for some examples on how to use the ComboBox with
adding items if i have more than one column ect....

When I do a F1 on the control it says that it can't find the frm20.hlp help file.
Does anybody have this help file?

If so could you email it to jrcp@mctcnet.net otherwise an example would be great.

Thanks,
Jcrp
0
Comment
Question by:geo90
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 2

Expert Comment

by:Crin
ID: 2700798
check your mail :))

WBR

Crin
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2700817
So much for a knowledge *sharing* community :-(
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2700821
PS - The forms2.0 library is total rubbish. Try tabbing *backwards* out of one of its controls and you'll see what I mean. Yuck.
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 2

Accepted Solution

by:
Crin earned 50 total points
ID: 2700973
Ok, will repeat here :))


AddItem [Text for first column], Index (number of row) where row must appear.

Example 1:

Me.ComboBox1.AddItem "", 1
Me.ComboBox1.AddItem "", 2
Me.ComboBox1.AddItem "", 3

Me.ComboBox1.List(1, 1) = "Text for Column 1 of Row 1"
Me.ComboBox1.List(1, 2) = "Text for Column 2 of Row 1"
Me.ComboBox1.List(3, 1) = "Text for Column 1 of Row 3"



Example 2:

Suppose we have table contained Fields FirstName, SurName, Phone and ID


Dim Rs as Recordset, i as Long

Set Rs = db.OpenRecordset("MyTable")
if Rs.RecordCount> 0 then
  With Me.Combo1
    .Clear
    .ColumnCount = 4
    .BoundColumn = 1   'will store IDs
    .ColumnWidths = "0;1;1;1"   'Hide IDs from user by setting its column width to 0
    rs.MoveFirst
    'Add each record to Combo
    while not Rs.EOF
      .AddItem "", i
      .List(i,1) = Rs!ID
      .List(i,2) = Rs!FirstName
      .List(i,3) = Rs!SurName
      .List(i,4) = Rs!Phone
      i=i+1
      Rs.MoveNext
    Wend
  end with
end if
rs.close


With best regards

Crin
0
 

Author Comment

by:geo90
ID: 2701542
Thanks a lot!
0
 
LVL 2

Expert Comment

by:Crin
ID: 2701551
Hope my comments was useful :))

Crin
0
 

Expert Comment

by:Maritimer
ID: 22238219
I am just testing right now. Will let you know shortly
0
 

Expert Comment

by:Maritimer
ID: 22238311
When the user clicks on the Combo. What is the syntax to retrive fthe value from a spicific column??
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…

776 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