473,396 Members | 2,029 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.

MS ACCESS How to Disable line items in listbox?

66 64KB
Hi Guys,

I have two listbox A and B in my form, both the listboxes are having same source to one of my table say it as TABLEA. Now I want to disable few line items in listbox B when the user select those items in listbox A.

Eg. Listbox A and B are having employee names, if the user selects "JOHNY" name in listbox A the line item "JOHNY" in listbox should be shown but disabled.


Please advise on how to complete this task.
Feb 18 '15 #1
4 2998
Seth Schrock
2,965 Expert 2GB
"items" in a listbox are not objects that have enable/disable properties. They are just records that have text. You may be able to do some formatting (just maybe) on certain lines if you add a Selected field to your TABLEA and use the OnClick or OnDblClick events to change the value of the Selected field, but you would have to play with that a little bit.
Feb 18 '15 #2
johny6685
66 64KB
Ok, so is there a way to removeitems from LISTBOXB that are selected in LISTBOXA?
Feb 18 '15 #3
johny6685
66 64KB
Ok... Here I have coded with an additional table created for that.



Expand|Select|Wrap|Line Numbers
  1. Private Sub lstRowDtls_AfterUpdate()
  2. Dim varSelected, lstitm As Variant
  3. lstColData.Requery
  4.  
  5.     If Me.Subform.Visible = True Then
  6.         Me.Subform.Visible = False
  7.     End If
  8.  
  9.     DoCmd.SetWarnings False
  10.     DoCmd.RunSQL "DELETE * FROM tbltmpColmlst"
  11.     DoCmd.SetWarnings True
  12.  
  13.  
  14.     For Each varSelected In lstRowDtls.ItemsSelected
  15.     lstitm = Me.lstRowDtls.ItemData(varSelected)
  16.     DoCmd.SetWarnings False
  17.     DoCmd.RunSQL "INSERT INTO tbltmpColmlst (Elemenators) VALUES ('" & lstitm & "')"
  18.     DoCmd.SetWarnings True
  19.     Next varSelected
  20.  
  21.    Me.lstColData.Requery
  22.  
  23. End Sub
And my LISTBOXB Rowsource as below

Expand|Select|Wrap|Line Numbers
  1. SELECT FilterColumns.FieldNames
  2. FROM FilterColumns
  3. WHERE (((FilterColumns.FieldNames) Not In (SELECT Elemenators FROM [tbltmpColmlst])) AND ((FilterColumns.Required)=True));
Feb 18 '15 #4
Seth Schrock
2,965 Expert 2GB
So you got it to work?
Feb 18 '15 #5

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

Similar topics

1
by: Patrick L. Nolan | last post by:
We have a Tkinter application which has a menubar with cascade submenus. I would like to start the program with one of the submenu items state=DISABLED, then change it to state=NORMAL at a later...
3
by: darren | last post by:
How, using asp.net (vb.net), can I remove multiple selected items from a listbox. Everything I try does not seem to work. Thanks in advance.
0
by: hpi | last post by:
Hi, I have 2 listboxes (and some other stuff) on a form The first listbox has an onclick event which, when fired, adds an item to the second list box and sets the selected item to the last item...
2
by: Amelyan | last post by:
If I have spaces in my Text property of Label, and I add it to TableCell, it wraps at spaces. E.g. Label lb = new Label(); lb.Text = "Hello, World!" TableCell cell = new TableCell();...
1
by: David Miller | last post by:
Does anyone know if you can disable an individual item in the listbox. Thanks, David
3
by: MervinJadhav | last post by:
How to disable combo items? Mervin Jadhav Software Developer Solutiioneyes Pvt Ltd (http://www.solutiioneyes.com) 203, Sai Chambers, 16 Mumbai-Pune Rd, Pune - 411 003 INDIA
2
by: Claudia Fong | last post by:
Hi, I added a tabcontrol in a panel in my form. My tabcontrol have more than 3 pages.. each page contains textboxes, combobox, checkbox. I want to disable the items of each of the page of...
5
by: MrDeej | last post by:
I have just created a listbox function which fills different listboxes with data. Before we used a SQL wich appered in the listbox. But since we have experienced locking issues with this we converted...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.