473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Setting the multi select property of a list box in vba?

41
Is it possible to adjust the multi select property of a list box using VBA?

my initial thaught would be

Me.List43.multi select = simple

but this produces an error.
Jan 11 '08 #1
6 12640
Craggy
41
I have discovered that the way to set this particular property is:

Me.List43.MultiSelect = 1

however, this tells me that "You cant assign a value to this object"

Is it not possible to change the value of Multi Select on a list box?

this will seriously mess my project up if you cant since I need to be able to have the option to select one, or many for a list box.

I could probably get round this by having both a multiselect and a single select box on the form overlapping eachother, and hide the un-needed one so that only the needed one appears and is usuable, but this seems a little long winded for something that seems quite basic.
Jan 11 '08 #2
MikeTheBike
639 Expert 512MB
I have discovered that the way to set this particular property is:

Me.List43.MultiSelect = 1

however, this tells me that "You cant assign a value to this object"

Is it not possible to change the value of Multi Select on a list box?

this will seriously mess my project up if you cant since I need to be able to have the option to select one, or many for a list box.

I could probably get round this by having both a multiselect and a single select box on the form overlapping eachother, and hide the un-needed one so that only the needed one appears and is usuable, but this seems a little long winded for something that seems quite basic.
Hi

Extract from Access Help
Note You can set the MultiSelect property by using the list box's property sheet, a macro, or Visual Basic.

This property can be set only in form Design view.
So you can set it in code, but only with the form in design state ??

MTB
Jan 11 '08 #3
ADezii
8,834 Expert 8TB
I have discovered that the way to set this particular property is:

Me.List43.MultiSelect = 1

however, this tells me that "You cant assign a value to this object"

Is it not possible to change the value of Multi Select on a list box?

this will seriously mess my project up if you cant since I need to be able to have the option to select one, or many for a list box.

I could probably get round this by having both a multiselect and a single select box on the form overlapping eachother, and hide the un-needed one so that only the needed one appears and is usuable, but this seems a little long winded for something that seems quite basic.
You can change the Value of the MultiSelect Property, but it is not exactly intuitive how to do so:
  1. It can only be changed in Design Mode.
  2. You must use the Absolute Reference to the List Box as in:
    Expand|Select|Wrap|Line Numbers
    1. Const conNone As Integer = 0
    2. Const conSimple As Integer = 1
    3. Const conExtended As Integer = 2
    4.  
    5. DoCmd.OpenForm "Form1", acDesign, , , , acHidden
    6.   'Forms!Form1!lstMultiSelect.MultiSelect = conNone
    7.                         'OR
    8.   'Forms!Form1!lstMultiSelect.MultiSelect = conSimple
    9.                         'OR
    10.   'Forms!Form1!lstMultiSelect.MultiSelect = conExtended
    11. DoCmd.OpenForm "Form1", acNormal, , , acFormEdit, acWindowNormal
  3. Any other questions, feel free to ask.
Jan 11 '08 #4
Craggy
41
Yea, i read that and it seemed a little strange.

Im not sure why you would program the state of an object using vba while your in edit mode.

I resorted to having the 2 list boxes overlapping, it works fine but seems a little unecesary...
Jan 11 '08 #5
Craggy
41
Thanks ADezii,

unfortunately havign it change only when in design is not useful for this particular application. i managed a work arround though so its ok.

The more I use access VBA the more i think its unecesarily complicated.
Jan 11 '08 #6
ADezii
8,834 Expert 8TB
Thanks ADezii,

unfortunately havign it change only when in design is not useful for this particular application. i managed a work arround though so its ok.

The more I use access VBA the more i think its unecesarily complicated.
Thanks ADezii,

unfortunately havign it change only when in design is not useful for this particular application.
You are quite welcome. Just for curiosity, why would you want to dynamically change the MultiSelect Property, and why isn't it usefull for your particular Application?
Jan 11 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: ColinWard | last post by:
I have a multi- select list box on my form. It works fine except that I have to click on every value I want to select. Is there a way to make the multi-select list box behave so that when you hold...
1
by: NYprmr | last post by:
Hi All, I'm trying to get value from Listbox where Multi Select property is set to Simple, meaning multiple values can be selected. Doing regular loop like following, retuns NULL value for each...
2
by: google | last post by:
Hello everyone, I am having an issue using the "Multi Select" option in a list box in MS Access 2003. I am making a form that users can fill out to add an issue to the database. Each issue can...
5
by: dkelly925 | last post by:
Is there a way to add an If Statement to the following code so if data in a field equals "x" it will launch one report and if it equals "y" it would open another report. Anyone know how to modify...
5
by: Matthew Wells | last post by:
I have a listbox set to simple multi select. For this example, users only select one item at a time. I have command buttons on the form for First, Previous, Next, Last, New (record). The form...
6
by: dbuchanan | last post by:
There are three parts to this 1.) How do I cascade menus? 2.) And, how do I cascade menus with a multi-select CheckBoxList?
11
by: woodey2002 | last post by:
This problem is driving me crazy. Hello there, i am trying to create a search form for records in my access database. The search form will contain text boxes and a multi select list box. The user...
6
by: woodey2002 | last post by:
Hi Everyone. Thanks for your time. I am trying to create a search form that will allow users to select criteria from multiple multi select boxes. So far i have managed to achieve a search option...
7
by: usr123 | last post by:
Hi, I need a multi select combo box on ASP page. Scenario: on page there is a table with few columns. In multi select box, i need all the table columns,let user select a few, and show only...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.