Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Fill A Combobox


Hi all,

I wanna fill a combobox with a range of cells that contain some characters.
Some of them are subscript or superscript.
That I want to do, is to fill the combobox preserving the format of the characters in the original cells.
Now I am using the following code to fill my combobox named ZoneList but I am sure it misses something for that I want.

For i = 1 To 10 Step 1
ZoneList.AddItem Sheets("Feuil1").Cells(i, 1).Format
Next i

Thank for your help
Defré.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Combobox Fill In
how can you make a combobox fill in with the records from an access data base?
example:when you have A database with table students and you wanne add 1 new you can only add 1 to a clas who realy is, and i want a combobox with the classes .

Fill Combobox
Hi,

When I load the form, I want to load all zipcode table into the cbx but I want to leave the zip code of the first client selected. And when I change client I want to change the cbx text value.

any idea?

thanks

Fill 2nd Combobox
I have the following code for my fost combobox; CODEPrivate Sub Userform_Initialize()

    Dim ws As Worksheet
    
    Set ws = Worksheets("Employees")
    Set MyRange = ws.Range("A2", ws.Range("A150").End(xlUp))
    
With Me.Employee
.RowSource = ws.Name & "!" & MyRange.Address
.ListIndex = 0
End With

End Sub

How To Fill Combobox ?
What I try to do is:
1. I have a form with many "combobox"
2. I have a text file with two strings at each line, the first is the "combobox" name, and the second is the value that I would like to add to this particular combobox.
3. I read each line from that text file
What I am asking is: how do I "additem" to the combo which name is the first string and the text that should be added is the second string.

Fill More Then 0ne Combobox In A Userform
Hello.

I'd like to fill 4 comboboxes on a userform. The problem is i don't know how to loop through the 4 combobox object.

Thanx in advance.

Werner

my code:

Code:
Private Sub UserForm_Activate()

Dim cmb As ComboBox
Dim cmbo() As ComboBox

fileGrootBoek = "C:XXXXXurenverantwoordingGrootboek.xls"
qry = "SELECT nr, grootboek FROM `Grootboek$`"

'get a handle on all comboboxes
For Each cmb In frmGrootBoek
Set cmbo(i) = cmb
Next

'counters
i = 0
j = 0

'Fill form with values from excel sheet
Call test

'Execute query
Set result = Gegevens.QrySelect(fileGrootBoek, qry)

'Fill comboboxes wich are named: cmbGB1, cmbGB2, cmbGB3 and cmbGB4
'First empty combobox
For Each cmb In frmGrootBoek

cmbo(j).Clear

'code to fill combobox
Do While (result.EOF = False)

cmbo(j).AddItem (result.Fields(1))
cmbo(j).List(j, 1) = result.Fields(0)
j = j + 1
result.MoveNext

Loop

Next

'close recordset
result.Close
Set result = Nothing

End Sub

Fill Combobox From Listview
I've got the Problem that I need to "copy" a column out of a listview-field into a combobox.
It's working that far, but I'm doing it in two steps. At first I copy the values from the listview to a worksheet and in the second step I fill the combobox with the help of Rowsource.

Is there any posibility do this easier in maybe one single step?

EDIT: I've found the solution... was just to blind to see it directly. I'm just getting started with VBA programming

Fill 23 Combobox With The Same Info
hi!, look i have a form that contains 23 combobox, all with the same info (blaxk, white, ...), a now i can do it in like this


Private Sub UserForm_Initialize()

ComboBox1.AddItem "black"
ComboBox1.AddItem "white"
ComboBox1.Value = "choose"

ComboBox2.AddItem "black"
ComboBox2.AddItem "white"
ComboBox2.Value = "choose"

ComboBox3.AddItem "black"
ComboBox3.AddItem "white"
ComboBox3.Value = "choose"
.
.
and so , and so, but come on, there ir other way to do this. plz can u help me

Fill Combobox With Query
I have filled the values of my combo box with a query from an access database, and have been unable to figure out how to let the combo box allow other values typed in. If it is not included in the query, I cannot type the value in. I have played around with the properties with no luck.

Can I Automatically Fill In A Combobox?!?!
I have a combobox and the list comes from an access file. I want to have it so when the user tabs onto the combobox and starts typing the closest match would come up with a blue backround and if the user tabs over again it will fill the combobox. I know I have to do it in the change event and change the backround color but I'm just need to be zapped with a defribulator to my brain..... any ideas I'll try to figure it out until then... but any help will be appreciated

Fill Array From Combobox
I am currently writing a program which I cant seem to quite finish.. I fill a combobox with multiple lines, consisting of 5 elements delimited by commas. I then am trying to write them separately to a text file which I am using in another program. I think the best way to do that is to store the combobox contents to an array then to a text file.

currently looks like this in the combo box

Bagatelle, Beethoven, Piano Sonata, THIRD, 7
Seven Garden, Motzart, String Symphony, FIFTH, 2



I need it to look like this in the text file

Bagatelle
Beethoven
Piano Sonata
THIRD
7
Seven Garden
Motzart
String Symphony
fifth
2

Use ComboBox To Fill In Other Fields?
I either don't understand ComboBoxes or I just don't know what they can't do.

I have a ComboBox (cboOdds) with a prefilled list of 8 options that will never change (I am using Style "2 - Dropdown List"). I want to be able to select one of the items in the list and have this immediately fill a text box (txtOdds) with text connected to that item in the list. If I then select a different choice from the ComboBox, the information in the text box will be changed to the new information connected to the second item and so on.

In short, turning the ComboBox into the trigger for a text box auto-fill.

Fill Combobox With Records...
assuming i have a mdb Mymdb in a server dir \myservermydirMymdb.mdb in this mdb have table_01 with field Test_01

i would want to fill the combobox1 with the records in Table_01...
Naturally fill the combobox1 wothout balnk records...
how can?
Tks.

Using SQL To Fill A ComboBox [SOLVED]
Hi all!

I'm using this code below to add the content of the first column (CHP) of my database to a ComboBox. I'm not a sql-Expert, so I would like to ask how I add the first and the second column (NCHP) to this ComboBox (in one row: Combo1.Additem Column1 & Coulmn2).



VB Code:
Dim db As Database        Dim rs As Recordset        Set db = OpenDatabase(TOURENWF.F4UG5T02.Text)        Set rs = db.OpenRecordset("SELECT CHP, Count(CHP) As InitCount FROM Tab1 GROUP BY CHP")        Do Until rs.EOF            Combo1.AddItem rs!CHP             rs.MoveNext        Loop        rs.Close        db.Close


Hope u understand my problem!
thx, Matt

Fill A ComboBox With Fonts
Hi all,

hoe can I fill a ComboBox with all Fonts that are available at the system ??

CU
Kreuzfeld

Fill Combobox From Database
I have an Access dataBase and need to fill a ComboBox with the contents of a specific field, I'm just trying out database stuff so be gentle with me.

I can get all the field into textbox's and advance through them add, delet ect but I've been up since 3.30
this morning thinking obout it.

The DataBase is called Mailing and the filled is called Email. I know Boring names but what the Hell.

Fill A Combobox From A Textfile?
I want to fill a combobox with each line from a txt file. For example the text in mytext.txt looks like:

Adress 1
Adress 2
Adress 3


I want to add this 3 lines in to my combobox, how?

Database ? - Fill A ComboBox
How would I go About using ADO to fill a combo box...

I am using this...(but somehow i think it could be done a little better )

rs.MoveFirst
Do While Not rs.EOF
cmbID.AddItem rs!reqID
rs.MoveNext
Loop
rs.MoveFirst


reqID is the field name...

Creating Sub To Fill Combobox. Help
Hi all,

I have a sub which I want to call to fill a combobox. But it doesn't work. Here's the code:
---------------------------
Sub AddListItems(cmbname As ComboBox)

Dim sTemp As String
cmbname.Clear

Open (App.Path & "list.txt") For Input As #1
While Not EOF(1)
Line Input #1, sTemp
cmbname.AddItem sTemp
Wend
Close #1

End Sub
----------------------------

For example when the combobox I want to fill is named cmbStuff, I would call it AddListItems (cmbStuff)

It should work right? But it doesn't. It gives me type mismatch.

If I replace the line
"Sub AddListItems(cmbname As ComboBox)"
with
"Sub AddListItems"
and change all the "cmbname" with "cmbStuff" in the above code, and call the simply by AddListItems, it works FINE.

Where is my mistake? Thanks in advance for any help.

Martin

How To Fill 3 Combobox With The Index....
assuming i have combobox1, combobox2, combobox3 ho to fill( in initialize form) all combobox with unique item in this mode:

combobox1 column D
combobox2 column H
combobox3 column L

and use the cmobobox2 similar index...

Example:

if i select in comobox2=SEGNO SALDO ANOMALO
auto fill comobox1=150001059999
auto fill combobx3=4500

if i select in comobox2=SEGNO IMPORTO ANOMALO
auto fill comobox1=150008040030
auto fill combobx3=4500

ecc...

in effect auto fill other combobox based combobox2






Edited by - Geof on 2/24/2007 7:50:54 AM

How To Fill A Combobox With Available DSN Entries?
How to fill a combobox with available DSN entries?


Initiative is to success what a lighted match is to a candle...

Combobox List Fill Range
I have a spreadsheet with three comboboxes. The first combobox lists whether or not the wood beam is sawn or glue laminated (for example). The second combobox lists the species of the wood (oak, cedar, etc.). The third combobox lists the available grade (stud, utility, etc.). All 3 comboboxes are based on a fill range within the spreadsheet and all three are written with VBA code. My hangup is that there is a situation when the wood beam size is based on a different fill range.
Is there a way to get excel to recognize something along the lines of:

If combobox2.text<>"Southern Pine" or "Mixed Southern Pine" then
combobox6.listfillrange="AI2:AI9"

I know this can be done with data validation but I would prefer to use VBA.

Fill A Combobox Via VBA With Directory Names
I was searching in the archive of this forum, but i never saw a good answer to my question.
What i like to have is, that when my sheet is loaded, automatically fills a ComboBox (/drop down list) with all directory names, in a specific directory (e.g. look in c: est and if there are directorys in it, show them in the combobox).

I am aware of the excell method, to place the founded values in a cell, and with a linked cell and linked range, i can show the values in the list. But i don't want to do that, i want that vba fills that combobox.
a>is that possible
b>is it possible to do that on load.
The object combobox is never been accepted as an object, except in the sheet code itself.
anyone?

Fill Combobox With Results Of Findnext
Hello,

I have a number of sheets, all containing football team names.
I run a find macro based on a a text string; this only finds exact matches. If no exact matches occur, I need a combobox populated with all the results of another find search; this time an (xlpart) search. All the nearest matches need to be shown, with an option to pick the correct one. e.g Let's say I search for "Man"; I would like a box populated with "Manchester United", "Manchester City", "Mansfeild", etc.

If anyone has any code, or previous experience of such a problem I would be most grateful.

Cheers

H

Fill ComboBox With 'drive-like' Info
I read most of threads pertaining to using code to select folders versus files. Specifically using the API calls BrowseForFolder and the CommonDialog. Below is an image I'd like to recreate in code. Specifically, filling the ComboBox with the drive information. I believe if I could get that far I could get the rest.

http://www.bluerivercofc.org/images/combobox.jpg

Any assistant would be greatly appreciated.

--Gary

Auto Expand/Fill In ComboBox
I am looking for a way to "auto fill" a combo box as the user types.
For example, if the combobox contains "ab, abra, abraca", "ab" should appear as soon as "a" is typed, then "abra" as soon as the "br" is added, etc.

MSAccess has this feature in the ComboBox Properties called "Auto Expand." I found in a reference book that Style = 1-Simple Combo is supposed to do that (called Extended Matching) in VB6. However, it only works if the user presses the down key after typing the first few letters.

Finally, I found some code at http://www.xtremevbtalk.com/show...ended+matching which is supposed to do that.

Is there any easy way/setup to achieve this?

Thanks!
hervé Chain
Houston, Texas

Auto Completen ComboBox + DB Fill...
Ok looking for the control for an autofill combobox

I am accessing a database doing so

VB Code:
Private Sub searchLname()Set rs = New ADODB.RecordsetDim SQL As StringSQL = "Select Lname from userTable"[b]rs.Open SQL[/b] [i]'choking here[/i]Do While Not rs.EOFuComboLname.AddItem rs!Lnamers.MoveNextLoopEnd Sub


Runtime error COnnection is either closed or invalid

Is my open line wrong?

My end result should be to fill this combo box with all the last names of people, and when the user is searching for a user it should autocomplete based on that list in the combobox.

Thanks

Fill Combobox With Data And 1 Option All
Hi

How Do I fill a combobox with the data from query and an option all ?

thank you in advance

Fill TextBox Linked To ComboBox (Access)
It's been awhile since I've used Access, so bear with me.
I have a combobox that is linked to Column A in Table A. When the user selects something from the combobox, I want the associated information in Column B in Table A to fill a TextBox. Also, if I make changes to the information in the TextBox, I want that to replace what was there. Is this possible (I'm assuming it is)? Is it done through a Macro or VBA (or other???)? Thanks in advance!!

With ComboBox Changing Fill Color Ellipse
Hello,

I am a starting VB programmer and i've got a little problem.

My goal at this moment is maybe very simple, but I just don't have the knowledge (yet) to know to solve this.

I want to change the color of my ellipse by selecting a value from a ComboBox2

ComboBox2 contains the names of the colors like Firebrick, Red, bla bla.

The problem is indicated at the bottom of my script. I've tried some things, which should be logical for me, but the don't work.


Code:
Private cCircleColor = Color.Brown 'my ellipse color var

Sub flips(Optional ByVal e As System.Windows.Forms.PaintEventArgs = Nothing)
Static varE As System.Windows.Forms.PaintEventArgs
If Not e Is Nothing Then
varE = e
End If

varE.Graphics.FillEllipse(New SolidBrush(cCircleColor), iX, iY, 25, 25)
End Sub 'flips

Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
cCircleColor = Color.(ComboBox2.SelectedItem)
' ^^ This is the part
Call flips()
End Sub
Hope someone can help me 'ere

Fill TextBox Linked To ComboBox (Access)
This is a repost from a posting I did in the VBA forum. I wasn't sure if I needed to ask it there or here...sorry.

It's been awhile since I've used Access, so bear with me.
I have a combobox that is linked to Column A in Table A. When the user selects something from the combobox, I want the associated information in Column B in Table A to fill a TextBox. Also, if I make changes to the information in the TextBox, I want that to replace what was there. Is this possible (I'm assuming it is)? Is it done through a Macro or VBA (or other???)? Thanks in advance!!

[solved] Fill Combobox With Database Values
Hi,

I have the following tables in a Access 2000 database:

tab_employee
---------------------
ID
name
department (number)



tab_department
---------------------
ID
department


Now I have created the following recordsets:


Code:
rsEmployee = "
SELECT * FROM tab_employee, tab_department
WHERE tab_Mitarbeiter.department = tab_department.ID"

rsDepartment = "SELECT * FROM tab_department"


Now I fill a a formular of Employees with my rsEmployee and put a Datacombobox with the Department on the formular:


Code:
Set dcombo.RowSource = rsDepartment
dcombo.ListField = "Department"


I get a problem when I´d like to show the department of an employee in the Datacombobox:


Code:
If Not IsNull(rsEmployee.Fields("department").Value) Then dcombo.Text = rsEmployee.Fields("department").Value


Because I can´t readout rsEmployee.Fields("department"). But when I test my SQL statement of the rsEmployee in Access it runs...Can anybody help me?

Thank you for all considerations,

Andy

Module Level Combobox Fill Routine
Hi all. I have a quick question. I think this should be simple, but I can't get it to work. Throughout my app, I have a number of combo boxes that display all of the US states. The states are loaded from a database, and I'm trying to write a module level procedure that I could call to fill the state combo boxes when I need to, but I cant' get it to work. Any suggestions?

Thanks

FLL

Fill In Textbox Based On A Combobox Selection
I am connecting to an Access DB using ADODB from a VB6 application. I can connect to the DB, and create recordsets. What I need a bit of help with is:

I want a text box to automatically be filled in with a field (field=Location) after the user selects an item from a dropdown box (field=iPAQ). The two fields are in the same table (table=iPAQs) so the two fields would be from the same record. I just want the text box to be automatically filled in.

Here is how I make the recordset for the iPAQs table:
Code:
    'Loads iPAQs table into rsiPAQs
Set rsiPAQs = New ADODB.Recordset
With rsiPAQs
    .ActiveConnection = cnMHS
    .CursorLocation = adUseClient
    .CursorType = adOpenStatic
    .LockType = adLockPessimistic
    .Source = "SELECT * FROM iPAQs"
    .Open
End With


Then I load the records from the iPAQ field into a combo box (CboiPAQ) using:
Code:
    'Fill the iPAQ Combobox
Do Until rsiPAQs.EOF
    CboiPAQ.AddItem rsiPAQs!iPAQ
    rsiPAQs.MoveNext
Loop


I hope I explained that all OK.
Thanks for any help or pointers anyone can provide!

Ray



Edited by - rjholtz on 6/1/2005 7:22:14 AM

(solved) Fill Combobox Based Sheet...
I have a form with 4 tab named with the sheets in workbook...
Now how to fill if i click on tab CORPORATE the combobox1 with the data in sheet CORPORATE with the jlon of column A " - " & " colum B &" - " column C
example:

  OI26710    - ARENA DOMENICO - RESP1
  OI29651    - CALCAGNILE ETTORE - RESP1
ecc...


... and combobox2
  
with the data in sheet RETA__POE with the jlon of column D " - " & " colum E &" - " column F
example:

OI32227- CARILLO VINCENZO - RESP2
OI29651- CALCAGNILE ETTORE - RESP2

ecc...

naturally if i click on tab RETA__POE use the value into this sheet t RETA__POE to fill the 2 combobox...

hope you understand me...



Edited by - luca91 on 12/28/2006 4:40:05 AM

Fill A Combobox From Table In Mysql Database
Hi,
I'm sure this question has been asked before but I couldn't find an occurence of it.

I've got 2 comboboxes on a form and I'd like to fill them from a table in a mysql database. Any advice on how this should be done?

Thanks,

Mag2

Fill Combobox List With List Of Unknown Length
right now i am populating the combo box list like this :

Sub LoadApps()
cmbApps.ListFillRange = "Extras!A11:A12"
End Sub

However the list could grow and it could to A11:A100

is there a way to select from A11 until the last filled in cell in column A?

Fill Listview Then Double Click To Fill Text Boxes (Resolved)
Hello

I have been working on this project off and on for about 6 months. What I am trying to do is use a text box search and fill a list view with the results. Then select the one I want and have it populate some text boxes on another form. all the fields can contain alpha numeric characters. I have attached the program. If any one can help me it would be greatly appreciated. I have been trying various combinations but have had no success.

Thanks
Bob



Edited by - Bob Taylor on 7/29/2003 4:08:49 PM

Trying To Fill Up A Felx Grid. But It Wont Fill
Hi im trying to write some code for a flex grid to display the ContactMethod and then Contact information.
they come from different tables.
but i have a nice sql for it and it wont fill in at all. it just displays blank boxes every time.

i have on my form load to call in this order
FormatGridBefore
FillGrid
FormatGridAfter

heres the codes:

Private Sub FillGrid()
strsql = "SELECT tblALLcommunication.CommMethod, tblEMPLOYEEcontact.Connection FROM tblALLcommunication INNER JOIN tblEMPLOYEEcontact ON tblALLcommunication.CommID = tblEMPLOYEEcontact.CommID"
Set rs2 = New ADODB.Recordset
rs2.Open strsql, cn, adOpenKeyset, adLockOptimistic, adCmdText
Set flexcontacts.DataSource = rs2
flexcontacts.Refresh
rs2.Close
Set rs2 = Nothing
End Sub

Public Sub FormatGridAfter()
With flexcontacts
.ColWidth(0) = 1520
.ColWidth(1) = 1520
.ColWidth(2) = 3037
End With
End Sub

Public Sub FormatGridBefore()
flexcontacts.FixedCols = 0
End Sub

Fill Listbox/datalist Using Result From SQL Query, Then Use Listbox To Fill A 2nd Listbox
Need some code that will fill a listbox or a datalist with the result of a SQL query
(the result will really just be many single fields ie. EMP00001, EMP00002, EMP00003 etc. and I need these passed one by one to the listbox/datalist).


Also, when they have been instantiated, I will need the current (hightlighted) item in the listbox at the time to be used
to populate a second listbox/datalist <----- Assuming another SQL query will be necessary?


Can anyone help with the code for this?


And which is better to use for this purpose - a listbox or datalist?

Combobox: Automatch Item, Select In Other Combobox, Remove From Both
I have 2 comboboxes and a listbox. I want the user to select an item from one combo, with then matches the item to its corresponding item in the 2nd combo, then add both to a list box. The user can either select from the 1st combo or from the 2nd...either one will match to the corresponding item in the other. Both comboboxes also have to be autocompleting. Once the selection is added to the listbox, the user can remove it which will delete the item from the list and add them back into the appropriate comboboxes. I have this working except for one thing.

When autocompleting, if the user types in what they want and its found and they hit ENTER, I am getting an error when trying to remove the item from the combos. It tells me the index is invalid and sure enough, when I check what the index is, its -1. It seems that the user isn't selecting an item in the combo even though its matched.

This is what I tried. It works if an item is clicked or chosen by pressing the up/down arrows. It also works if they type what they want, its matched, then they press up/down or some other number but will NOT work if they just type it, its found and they hit enter:


Code:
Private Sub cmdAdd_Click()
List1.AddItem cmbo(0).Text & " " & cmbo(1).Text

cmbo(0).RemoveItem (cmbo(0).ListIndex)
cmbo(1).RemoveItem (cmbo(1).ListIndex)

End Sub

Oddly, if I put the opposite combo item to be deleted, it works...so, if I just selected something from combo 1, the following works:


Code:
Private Sub cmdAdd_Click()
List1.AddItem cmbo(0).Text & " " & cmbo(1).Text

cmbo(0).RemoveItem (cmbo(1).ListIndex)
cmbo(1).RemoveItem (cmbo(1).ListIndex)

End Sub

Any ideas anyone? Perhaps I need to post the function I use for autocompleting? Let me know please...

Text In Combobox Appears In Combobox Field
Hi,
Anyone know how to select the text in a combobox when the user types in its field? For example, if the use types Fr in the combobox field , the selected item would be France and would appear in the combobox field from a list say consisting of [Spain, Portugal, France].
Thanks.

[Solved] How To Change The Content Of An Combobox With An Other Combobox
Hi, I'm new,
but I already have a question:

How do I Change the content of an combobox by choosing the things in an other combobox?

For example, there are two comboboxes. They are both about color.
In the first combobox you select a color like purple, green and blue.
Once you've selected blue, the other combobox comes active, and you can select light blue, normal blue or dark blue.

What I'm creating is a program "for restaurants". It has two comboboxes. In the first combobox you choose the "Type or order", like noodles, rice or pizza. After you've selected something, an other combobox becomes active. If you've selected pizza in the first combobox, then the content of the second one is like: Pizza Hawaii, Pizza al tonno, Pizza BBQ. But, if I selected rice in the first combobox, then the second combobox should give the options "Rice with vegetables" and "Rice with chicken".

This is the code I've written:

Private Sub CommandButton1_Click()
lstOrderlist.AddItem cmbGerecht
End Sub

Private Sub CommandButton2_Click()
lstOrderlist.Clear
End Sub

Private Sub UserForm_Initialize()
cmbSoort.AddItem "Noodles"
cmbSoort.AddItem "Fried rice"
cmbSoort.AddItem "Pizza"

If cmbSoort = Empty Then
cmbOrder.AddItem ""

ElseIf cmbSort = "Noodles" Then
cmbOrder.AddItem "Noodles with chicken"
cmbOrder.AddItem "Noodles with beef"
cmbOrder.AddItem "Noodles with grease"

ElseIf cmbSort = "Fried rice" Then
cmbOrder.AddItem "Rice with chicken"
cmbOrder.AddItem "Rice with beef"
cmbOrder.AddItem "Rice with grease"

ElseIf cmbSort = "Pizza" Then
cmbOrder.AddItem "Pizza Al Tonno"
cmbOrder.AddItem "Pizza Hawaii"

End If
End Sub

Somehow, the second combobox remains empty.
Can someone tell me what I'm doing wrong??

BTW, to make things clear: cmbSoort is the "first combobox" from the example, and cmbGerecht is the second one.


Picture of the program with the names of the comboboxes (some words are in Dutch language):


The word-document (I created it with VBA in word):
http://www.megaupload.com/?d=QZETEAQ3
(sorry I don't know any other host)

Soo....I hope I'm being clear. Can someone help me out with this please? I really need to figure this out quick

Edit: The combobox problem is solved now, but not I've encountered 2 other things I need to solve, them it's done. See last reply.

VB6 Combobox Behave Like VB3 Combobox When Deleting Items
I have a fragment of combobox code from a VB3 legacy application, which isn't working the same when ported over to VB6.

I have a combobox with the 'Dropdown List' style, to which I've added several items. In VB6 if the combobox dropdown list is displayed, and the delete button is pressed, the combobox defaults to the original value. In VB3, the combobox items are deselected (ie. combo1.ListIndex = -1).

Here's the code -

VB Code:
Private Sub Form_Load()    Combo1.AddItem "Sample1"    Combo1.AddItem "Sample2"    Combo1.AddItem "Sample3"    Combo1.AddItem "Sample4"    Combo1.AddItem "Sample5"        Combo1.ListIndex = 0End Sub Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)    If KeyCode = KEY_DELETE Then        Combo1.ListIndex = -1    End IfEnd Sub

So I select an item from the first combobox, ensuring that the dropdown list is displayed -


While the dropdown list is displayed, I press the delete key -


I then select another control, so the focus is lost from the combobox -


Notice in the above picture, that instead of a blank selection I get the original item instead. In VB3, performing these steps results in a blank selection instead.

Without changing the Style to 'Dropdown Combo', or removing the deletion function, is there a way I can get this program to behave the same way in VB6 as it does in VB3?

How To Link A Combobox From A Database To A Combobox On A Form.
Goodday There,

I have a problem with linking a dropdown combobox from the database to a dropdown combobox in a form, Please help and I'm using access database by the way.

Thank you in advance...

Mfanelo

ComboBox - Displaying Database Values In A ComboBox
I am trying to insert values from a database into a combo box.

I have linked the datacontrol to the combo box and values from the database are displayed within the combox box. However can only be navigated using the data control. I would like the values to be listed within the drop down list of the combo box.

Can anyone help pls?!?!


Roshny

Filling A Combobox From Database But I Don't Want Duplicates In Th Combobox.
I want to output the contents of a database field (ms access) to a combobox but the field has many duplicates that I wish not to display. I just want one of each. Thanks

ComboBox Contents Are Longer Than The Size Of The ComboBox
My comboBox contents are longer than the size of the comboBox, how can i make the content to show when pointed by the mouce, so that the user can read the whole string and make selectin

Thanks

Filling A ComboBox Depending On Another ComboBox
Hi,

I want to fill a Combobox (cmb2) dependent on what the user has chosen in a first ComboBox (cmb1).

The first combobox ist based on a table, and the second combobox shall be filled with lines from another table, where only the lines are chosen that are relevant, fx:

table for cmb1:
A
B
C
D

Table fro where you choose the rows for cmb2:

A Boston
A Washington
A Baltimore
B Chicago
B Miami
C San Francisco
D Miami
D New York
D Los Angeles
D Las vegas

If the user chooses "A" in cmb1, in cmb2 shuld there so be only rows from the second table, where the first column is A.

Is there anybody out there who knows a solution?

Thank you very much!!

Combobox -- Database, Selection In Combobox
I am confused, and i am hopping that i write my problem acurately

I have combo boxes, which are filled from Data from the database when loading the form, each combobox filled with different tables. Lets assume each Table has TWO fileds 1. Code 2. Name. And I filled Combobox with "Name" filed values. In some Table "Code" is Integer/Number and in some tables it is "Text" filed.

Now what i actually want to do are following
1. I say to combobox to select/display "Name" of "Code" = 51, or "Code" = "AC01244"

2. When user select any Name form Combobox I get "Code" correspond to that "Name"

I try the following code but i could not resolved fully and specially for "Code" when it is Text.


VB Code:
' in Load form function     ' Text 0001    m_strSQL = "SELECT * FROM Programs ORDER BY code"    m_rsCommon.Open m_strSQL, m_conDatabase, adOpenForwardOnly, adLockReadOnly, adCmdText    If m_rsCommon.RecordCount > 0 Then        m_rsCommon.MoveFirst        For iLoop = 1 To m_rsCommon.RecordCount            'm_rsCommon.Fields ("code")            cmbPrograms.AddItem m_rsCommon.Fields("Name")            cmbPrograms.ItemData(cmbPrograms.NewIndex) = m_rsCommon.Fields("code")            m_rsCommon.MoveNext        Next    End If    m_rsCommon.Close     ' Text AC030001    m_strSQL = "SELECT * FROM Accounts ORDER BY AcCode"    m_rsCommon.Open m_strSQL, m_conDatabase, adOpenForwardOnly, adLockReadOnly, adCmdText    If m_rsCommon.RecordCount > 0 Then        m_rsCommon.MoveFirst        For iLoop = 1 To m_rsCommon.RecordCount            'm_rsCommon.Fields ("AcCode")            cmbAccounts.AddItem m_rsCommon.Fields("AcName")'            cmbAccounts.ItemData(cmbAccounts.NewIndex) = m_rsCommon.Fields("AcCode")            m_rsCommon.MoveNext        Next    End If    m_rsCommon.Close     ' Number    m_strSQL = "SELECT * FROM ROs ORDER BY EntryNo"    m_rsCommon.Open m_strSQL, m_conDatabase, adOpenForwardOnly, adLockReadOnly, adCmdText    If m_rsCommon.RecordCount > 0 Then        m_rsCommon.MoveFirst        For iLoop = 1 To m_rsCommon.RecordCount            'm_rsCommon.Fields ("EntryNo")            cmbROs.AddItem m_rsCommon.Fields("RO_Details")            cmbROs.ItemData(cmbROs.NewIndex) = m_rsCommon.Fields("EntryNo")            m_rsCommon.MoveNext        Next    End If    m_rsCommon.Close



VB Code:
' Select Name in Combobox according to their/passing Code VAluesPrivate Sub Command2_Click()'    cmbPrograms.ListIndex = (cmbPrograms.ItemData(73))'    cmbAccounts.ListIndex = (cmbAccounts.ItemData("AC00254"))    cmbROs.ListIndex = (cmbROs.ItemData(4360))End Sub ' Display Selected "Code" Private Sub Command1_Click()'    Debug.Print cmbPrograms.ItemData(cmbPrograms.ListIndex) 'Dispaly 77 even i passed 73    Debug.Print cmbAccounts.ItemData(cmbAccounts.ListIndex)     Debug.Print cmbROs.ItemData(cmbROs.ListIndex) ' Display 4706 even i passed 4360End Sub


I hope i am able to clear my problem

I am really looking for answere.... please give me any tip, example to overcome this problem

Thank to all in advance...

Copyright © 2005-08 www.BigResource.com, All rights reserved