-
I have been trying to do something with a combo box useing vb6 code and I'm close but cant get it to work
If anyone can give me a pointer I would be grateful.
I collect and hope to sell stamps.
I have a list of 116 countries and a data base of potential
collectors/customers
I have so far got a combo box (In Access 97) which displays the full list of 116 countries each country has an ID number.
I can select a country once and It is placed in the country field ..My problem is people will want more than one country, they may pick 20 or 30
I want to be able to select multiple countries and see them displayed in a list It needs to be an add/edit list. As a learner I have been battleing for two weeks but I need a little help.
With all the books and help tutorials around there isn't anything that gets close to what I want.(I'm just a learner at vb6 codeing)
Thanks in advance.
Tony
Can you help ? if you get the time Thanks in advance.
-
I've encountered this before.
What I did is set up two ComboBoxes, one with the potential choices, and another with the current selections.
We'll call them ComboMain and ComboSel
Set up a backend table (tbl_TempRecordset or somesuch) and have the selection event from the ComboMain (I use DoubleClick) append the appropriate record to tbl_TempRecordset, and requery ComboSel.
Aww hell, I'm not making sense. Here's the code.
Code:
Private Sub lstAllCodes_DblClick(Cancel As Integer)
'See Add_Click
Call Add_Click
End Sub
------------------
Private Sub Add_Click()
'Adds Purch Group to select list to generate report from.
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryAddBuyerToList"
If Me![lstAllCodes] = Null Then
msgbox "Please select a buyer code from the left list to analyze", vbOKOnly, "Input Error"
DoCmd.SetWarnings True
Exit Sub
End If
lstListAdd.Requery
DoCmd.SetWarnings True
End Sub
-------------------
DoCmd.OpenQuery "qryAddBuyerToList"
that's an Append query that adds the selection to the list.
On form unload that list is deleted. . .
I then join the tbl_TempRecordset to any queries I would be concerned with.
If you're still confused, I can send the database forms/code that accomplishes this.
[Edited by JohnAtWork on 03-20-2000 at 04:53 PM]