473,401 Members | 2,146 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,401 software developers and data experts.

Updating a Listbox

I have have two list boxes. One is a listing of all possible variables.
We'll call this listbox A. The other is a listing of all the selected
variables. We'll call this listbox B. If a person double-clicks on one of
the variables in listbox A it "moves" it to listbox B. What is going on
behind the scenes is that the table that holds all these variables has a
yes/no field call Print. When the user double clicks on the value it fires
a db.execute statement which is an Update SQL statement to put it in the
right state, either yes or no. This all works fine and dandy. What I'm
having a problem with though is that based on what values are chosen (those
in listbox B) other textboxes and option groups become enabled or disabled.
I put some code in the After Update event of listbox B which goes like this:

Private Sub lstPatronTypesInclude_AfterUpdate()

For x = 0 To lstPatronTypesInclude.ListCount
If Me!lstPatronTypesInclude.ItemData(x) = 6 Then
txtMembershipExpiredFrom.Enabled = True
Exit Sub
Else
txtMembershipExpiredFrom.Enabled = False
End If
Next x

End Sub

The problem is is that it only fires when I've clicked back onto listbox B.
So I could click away and all the variables I want, but if I don't click
onto listbox B, the other text boxes on the form don't change to enabled or
disabled. Is there a way to get this to happen or am I gooing about this
the entirely wrong way?

TIA,
Bill
Nov 12 '05 #1
5 3490
Have you tried using the code in the 'Click' event of the list box...
"Bill" <zi*****@hotmail.com> wrote in message
news:vo************@corp.supernews.com...
I have have two list boxes. One is a listing of all possible variables.
We'll call this listbox A. The other is a listing of all the selected
variables. We'll call this listbox B. If a person double-clicks on one of the variables in listbox A it "moves" it to listbox B. What is going on
behind the scenes is that the table that holds all these variables has a
yes/no field call Print. When the user double clicks on the value it fires a db.execute statement which is an Update SQL statement to put it in the
right state, either yes or no. This all works fine and dandy. What I'm
having a problem with though is that based on what values are chosen (those in listbox B) other textboxes and option groups become enabled or disabled. I put some code in the After Update event of listbox B which goes like this:
Private Sub lstPatronTypesInclude_AfterUpdate()

For x = 0 To lstPatronTypesInclude.ListCount
If Me!lstPatronTypesInclude.ItemData(x) = 6 Then
txtMembershipExpiredFrom.Enabled = True
Exit Sub
Else
txtMembershipExpiredFrom.Enabled = False
End If
Next x

End Sub

The problem is is that it only fires when I've clicked back onto listbox B. So I could click away and all the variables I want, but if I don't click
onto listbox B, the other text boxes on the form don't change to enabled or disabled. Is there a way to get this to happen or am I gooing about this
the entirely wrong way?

TIA,
Bill

Nov 12 '05 #2
You didn't give details of "moving the value to Listbox B", but it would
appear that doing so does not fire Listbox B's AfterUpdate event -- try
putting the code in the DoubleClick of Listbox A, after "moving" it to
Listbox B.

Larry Linson
Microsoft Access MVP

"Bill" <zi*****@hotmail.com> wrote in message
news:vo************@corp.supernews.com...
I have have two list boxes. One is a listing of all possible variables.
We'll call this listbox A. The other is a listing of all the selected
variables. We'll call this listbox B. If a person double-clicks on one of the variables in listbox A it "moves" it to listbox B. What is going on
behind the scenes is that the table that holds all these variables has a
yes/no field call Print. When the user double clicks on the value it fires a db.execute statement which is an Update SQL statement to put it in the
right state, either yes or no. This all works fine and dandy. What I'm
having a problem with though is that based on what values are chosen (those in listbox B) other textboxes and option groups become enabled or disabled. I put some code in the After Update event of listbox B which goes like this:
Private Sub lstPatronTypesInclude_AfterUpdate()

For x = 0 To lstPatronTypesInclude.ListCount
If Me!lstPatronTypesInclude.ItemData(x) = 6 Then
txtMembershipExpiredFrom.Enabled = True
Exit Sub
Else
txtMembershipExpiredFrom.Enabled = False
End If
Next x

End Sub

The problem is is that it only fires when I've clicked back onto listbox B. So I could click away and all the variables I want, but if I don't click
onto listbox B, the other text boxes on the form don't change to enabled or disabled. Is there a way to get this to happen or am I gooing about this
the entirely wrong way?

TIA,
Bill

Nov 12 '05 #3
I'm not sure I understand. I don't want to have to click on the list box.
When I move the the variable from the list of all variables to the list of
selected variables (through double clicking the "all-variables" list box) I
want to have the appropriate text boxes on the form to become active. It
doesn't become active until I have moved it over and then click on the
listbox of selected variable. Basically what is happening is the after
update event doesn't fire until i actually click on the list box.
"Ruskin Hardie" <Ru******@xtra.NOSPAM.co.nz> wrote in message
news:gW**********************@news.xtra.co.nz...
Have you tried using the code in the 'Click' event of the list box...
"Bill" <zi*****@hotmail.com> wrote in message
news:vo************@corp.supernews.com...
I have have two list boxes. One is a listing of all possible variables.
We'll call this listbox A. The other is a listing of all the selected
variables. We'll call this listbox B. If a person double-clicks on one

of
the variables in listbox A it "moves" it to listbox B. What is going on
behind the scenes is that the table that holds all these variables has a
yes/no field call Print. When the user double clicks on the value it

fires
a db.execute statement which is an Update SQL statement to put it in the
right state, either yes or no. This all works fine and dandy. What I'm
having a problem with though is that based on what values are chosen

(those
in listbox B) other textboxes and option groups become enabled or

disabled.
I put some code in the After Update event of listbox B which goes like

this:

Private Sub lstPatronTypesInclude_AfterUpdate()

For x = 0 To lstPatronTypesInclude.ListCount
If Me!lstPatronTypesInclude.ItemData(x) = 6 Then
txtMembershipExpiredFrom.Enabled = True
Exit Sub
Else
txtMembershipExpiredFrom.Enabled = False
End If
Next x

End Sub

The problem is is that it only fires when I've clicked back onto listbox

B.
So I could click away and all the variables I want, but if I don't click
onto listbox B, the other text boxes on the form don't change to enabled

or
disabled. Is there a way to get this to happen or am I gooing about this the entirely wrong way?

TIA,
Bill


Nov 12 '05 #4
So put the code, in the event of the "all-variables" list box, that causes
the value to move to the "selected variables" list box (ie: the double_click
event of the all-variables list box)...

"Bill" <zi*****@hotmail.com> wrote in message
news:vo************@corp.supernews.com...
I'm not sure I understand. I don't want to have to click on the list box.
When I move the the variable from the list of all variables to the list of
selected variables (through double clicking the "all-variables" list box) I want to have the appropriate text boxes on the form to become active. It
doesn't become active until I have moved it over and then click on the
listbox of selected variable. Basically what is happening is the after
update event doesn't fire until i actually click on the list box.
"Ruskin Hardie" <Ru******@xtra.NOSPAM.co.nz> wrote in message
news:gW**********************@news.xtra.co.nz...
Have you tried using the code in the 'Click' event of the list box...
"Bill" <zi*****@hotmail.com> wrote in message
news:vo************@corp.supernews.com...
I have have two list boxes. One is a listing of all possible variables. We'll call this listbox A. The other is a listing of all the selected
variables. We'll call this listbox B. If a person double-clicks on one
of
the variables in listbox A it "moves" it to listbox B. What is going
on behind the scenes is that the table that holds all these variables has a yes/no field call Print. When the user double clicks on the value it

fires
a db.execute statement which is an Update SQL statement to put it in the right state, either yes or no. This all works fine and dandy. What I'm having a problem with though is that based on what values are chosen

(those
in listbox B) other textboxes and option groups become enabled or

disabled.
I put some code in the After Update event of listbox B which goes like

this:

Private Sub lstPatronTypesInclude_AfterUpdate()

For x = 0 To lstPatronTypesInclude.ListCount
If Me!lstPatronTypesInclude.ItemData(x) = 6 Then
txtMembershipExpiredFrom.Enabled = True
Exit Sub
Else
txtMembershipExpiredFrom.Enabled = False
End If
Next x

End Sub

The problem is is that it only fires when I've clicked back onto listbox
B.
So I could click away and all the variables I want, but if I don't
click onto listbox B, the other text boxes on the form don't change to

enabled or
disabled. Is there a way to get this to happen or am I gooing about

this the entirely wrong way?

TIA,
Bill



Nov 12 '05 #5
oh...heh...well that would be just too dang easy, now wouldn't it?
Thanks...worked perfectly. :)
"Ruskin Hardie" <Ru******@xtra.NOSPAM.co.nz> wrote in message
news:sJ**********************@news.xtra.co.nz...
So put the code, in the event of the "all-variables" list box, that causes
the value to move to the "selected variables" list box (ie: the double_click event of the all-variables list box)...

"Bill" <zi*****@hotmail.com> wrote in message
news:vo************@corp.supernews.com...
I'm not sure I understand. I don't want to have to click on the list box.
When I move the the variable from the list of all variables to the list of selected variables (through double clicking the "all-variables" list box)
I
want to have the appropriate text boxes on the form to become active.
It doesn't become active until I have moved it over and then click on the
listbox of selected variable. Basically what is happening is the after
update event doesn't fire until i actually click on the list box.
"Ruskin Hardie" <Ru******@xtra.NOSPAM.co.nz> wrote in message
news:gW**********************@news.xtra.co.nz...
Have you tried using the code in the 'Click' event of the list box...
"Bill" <zi*****@hotmail.com> wrote in message
news:vo************@corp.supernews.com...
> I have have two list boxes. One is a listing of all possible

variables. > We'll call this listbox A. The other is a listing of all the selected > variables. We'll call this listbox B. If a person double-clicks on one of
> the variables in listbox A it "moves" it to listbox B. What is going on
> behind the scenes is that the table that holds all these variables
has
a > yes/no field call Print. When the user double clicks on the value
it fires
> a db.execute statement which is an Update SQL statement to put it in

the > right state, either yes or no. This all works fine and dandy. What I'm > having a problem with though is that based on what values are chosen
(those
> in listbox B) other textboxes and option groups become enabled or
disabled.
> I put some code in the After Update event of listbox B which goes like this:
>
> Private Sub lstPatronTypesInclude_AfterUpdate()
>
> For x = 0 To lstPatronTypesInclude.ListCount
> If Me!lstPatronTypesInclude.ItemData(x) = 6 Then
> txtMembershipExpiredFrom.Enabled = True
> Exit Sub
> Else
> txtMembershipExpiredFrom.Enabled = False
> End If
> Next x
>
> End Sub
>
> The problem is is that it only fires when I've clicked back onto listbox B.
> So I could click away and all the variables I want, but if I don't click > onto listbox B, the other text boxes on the form don't change to enabled or
> disabled. Is there a way to get this to happen or am I gooing about

this
> the entirely wrong way?
>
> TIA,
> Bill
>
>



Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hey_Moe! | last post by:
I have subform which uses a SQL statement as the record source. One of the criteria (ie. Part of the WHERE condition) is a column value from a ListBox on the MainForm. Two problems exist: 1....
3
by: gdbjohnson-AT-yahoo-dot-ca-nospamplz | last post by:
I have a ListBox built of a simple custom object for the ListItems used to be able to hold a Data Value, and a Display Value, with accessors for each. I have overridden the ToString method to...
1
by: Claire | last post by:
As a Listbox.item, rather than using a string I'm using a ListItems object, overriding the ToString method When I add items to listbox.items, my strings are shown correctly. On the otherhand, when...
1
by: MrNobody | last post by:
Hi, I'm doing something where I add custom objects to a ListBox which have aToString() method overriden so it displays what I want. When adding instances of these custom objects to the ListBox I...
1
by: Spock | last post by:
Hi. I have a form with a listbox and a few label fields all bound to a dataset. When i navigate the listbox the labels change accordingly. so far everything works good. I made a button to...
6
by: Zytan | last post by:
In win32 there was a way to 'turn off' a listbox from updating until you were done adding elements. Is there a way to do this in .NET? Zytan
6
by: =?Utf-8?B?S2Fp?= | last post by:
Hi all, using AJAX Toolkit with vb.net 2.0 how could I make this "Updating..." Screen like e.g. on Codeplex when you click on the "Vote" button...
2
by: julie18881 | last post by:
I may be being really stupid here, i have spent the last 3 hours looking round your site and some other for answers to my problem, but have not had much luck (possibly cuase my brain just isn't...
3
by: Reg Verrin | last post by:
I have a program that displays constantly changing prices which it sources from the web once per second. The prices are displayed on a Listbox (not the best choice but there are good reasons for...
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?
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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...

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.