Multiselect combobox

G

gatarossi

Dear all,

How can I do a multiselect combobox?

Is it possible for each data selected in this combobox add a new
textbox in my subform?

Can I have a button to exclude all textbox added and clear all
selections in the multiselect combobox?

Thanks a lot!

André.
 
D

Douglas J. Steele

You can't. Only list boxes can be multiselect.

You can't add text boxes to subforms in that way either: you'd have to have
a recordset based on which rows were multiselected in the list box. To see
how to use what's selected in a list box to limit a recordset, see
http://www.mvps.org/access/forms/frm0007.htm at "The Access Web"

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Dear all,

How can I do a multiselect combobox?

Is it possible for each data selected in this combobox add a new
textbox in my subform?

Can I have a button to exclude all textbox added and clear all
selections in the multiselect combobox?

Thanks a lot!

André.
 
G

gatarossi

Dear Douglas,

Thanks!!!!

As I'm a beginner user of access, could you help me with the code?

Firstly, How can I "transform" my listbox for multiselct listbox?

Please, I'm afraid because I didn't understand where I will put the
code and where I need to change the code to include textboxs in my
subform.

Private Sub lstdata_Click()

Dim frm As Form, ctl As Control
Dim varItem As Variant
Dim strSQL As String

Set frm = Form!orcamento_despesas
Set ctl = frm!lstdata

strSQL = "Select * from Employees where [EmpID]="
'Assuming long [EmpID] is the bound field in lb
'enumerate selected items and
'concatenate to strSQL

For Each varItem In ctl.ItemsSelected
strSQL = strSQL & ctl.ItemData(varItem) & " OR [EmpID]="
Next varItem

'Trim the end of strSQL
strSQL=left$(strSQL,len(strSQL)-12))

End Sub

I will be tankful if you understand my dificult.

I hope you answer!!

Thanks André.
 
P

pietlinden

Dear Douglas,

Thanks!!!!

As I'm a beginner user of access, could you help me with the code?

Firstly, How can I "transform" my listbox for multiselct listbox?
Set the Multi-Select Property to Extended or Simple. Then you can
select as many values as you want. If your plan is to write all this
to a subform, why not just set a unique index on (ParentID and the Key
value in the listbox?) Then you can't duplicate a value pair.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top