Help with Code - Create Textbox

  • Thread starter Thread starter gatarossi
  • Start date Start date
G

gatarossi

Dear all,

I'm trying to do a multiselect listbox, but I don't known how creat
it.

And I have other problem: for each data select in my multiselect
combobox I would like to create a textbox in my subform.

And when I will clear all selections in my multiselect listbox all
textbox that I created are deleted.

Is it possible?

As I'm a beginner access user, is anybody could help me with this
code?

Thanks!

André.
 
Hello André, welcome to access.

Let me start off by saying that what you are trying to do might be
better designed another way. This is a tough concept to explain
without knowing further details of what you're trying to do. Access
was made with the expectation that designers would do things certain
ways.

To create a multiselect list box, make a normal list box. Then go
into properties and choose "Simple" under the property "Multi
Select". Now go into the event properties and set up a code event for
"AfterUpdate". This is where I need more information.


If, for example, your text boxes already exist and there are a set
number of them, do this:

Private Sub List2_AfterUpdate()
If List2.Selected(1) = True Then
Me.subFormName.Form.txtBox1.Visible = True
Else
Me.subFormName.Form.txtBox1.Visible = False
End If

If List2.Selected(2) = True Then
Me.subFormName.Form.txtbox2.Visible = True
Else
Me.subFormName.Form.txtbox2.Visible = False
End If
End Sub


If your text boxes don't already exist, it is possible to create them
on the fly, but this is generally a bad idea.

Honestly I think you would be best off showing all your text boxes to
the user and just letting them fill in whichever ones they want to.

Best of luck,
~J
 

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

Back
Top