473,320 Members | 1,884 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,320 software developers and data experts.

Select all/none

In this single-user app I have a form with members. In the related table I
have a field 'Select' with which the user can select a record. I have two
buttons on the form (All and None) that select either all records or none.
Those buttons both work with an edit query. It works except for the current
record since that is locked. To avoid that I have added code that
specifically changes the Select value of the current record by Select=-1 (or
0). It works but the only annoying thing is that after the query Access
shows a dialog box "Info has been changed" with an OK button. What can I do
to avoid this button?
thanks,
john
Sep 7 '06 #1
5 2573
Hi John,

You need to insert this code, you only really need one button.

If you call that button 'btnToggle' and your list box 'lstSelection'
this code should work seamlessly when you insert it in the on click
event of your button.

Dim intSelected As Integer
Dim blnToggle As Boolean
If Me.btnToggle.Caption = "&Select all" Then
blnToggle = True
Me.btnToggle.Caption = "De&select all"
Else
blnToggle = False
Me.btnToggle.Caption = "&Select all"
End If
With Me.lstSelection
For intSelected = 0 To .ListCount - 1
.selected(intSelected) = blnToggle
Next
End With

Good luck

Nick

john wrote:
In this single-user app I have a form with members. In the related table I
have a field 'Select' with which the user can select a record. I have two
buttons on the form (All and None) that select either all records or none.
Those buttons both work with an edit query. It works except for the current
record since that is locked. To avoid that I have added code that
specifically changes the Select value of the current record by Select=-1 (or
0). It works but the only annoying thing is that after the query Access
shows a dialog box "Info has been changed" with an OK button. What can I do
to avoid this button?
thanks,
john
Sep 7 '06 #2
Oh I forgot to mention that you no longer need the edit query.

Best wishes

Nick

Nick 'The database Guy' wrote:
Hi John,

You need to insert this code, you only really need one button.

If you call that button 'btnToggle' and your list box 'lstSelection'
this code should work seamlessly when you insert it in the on click
event of your button.

Dim intSelected As Integer
Dim blnToggle As Boolean
If Me.btnToggle.Caption = "&Select all" Then
blnToggle = True
Me.btnToggle.Caption = "De&select all"
Else
blnToggle = False
Me.btnToggle.Caption = "&Select all"
End If
With Me.lstSelection
For intSelected = 0 To .ListCount - 1
.selected(intSelected) = blnToggle
Next
End With

Good luck

Nick

john wrote:
In this single-user app I have a form with members. In the related table I
have a field 'Select' with which the user can select a record. I have two
buttons on the form (All and None) that select either all records or none.
Those buttons both work with an edit query. It works except for the current
record since that is locked. To avoid that I have added code that
specifically changes the Select value of the current record by Select=-1 (or
0). It works but the only annoying thing is that after the query Access
shows a dialog box "Info has been changed" with an OK button. What can I do
to avoid this button?
thanks,
john
Sep 7 '06 #3
Thanks Nick,
The first part is working but I still have trouble with:
With Me.lstSelection
For intSelected = 0 To .ListCount - 1
.selected(intSelected) = blnToggle
It doesn't do what it's supposed to. I get an error on .Listcount. Is that
the correct code?

Let me add that in this form only one record of the underlying table is
visible on the form. So there's only one checkbox visible, but i want them
to be (un)checked by pushing the button.
john

"Nick 'The database Guy'" <ni***********@eads.comschreef in bericht
news:11*********************@m73g2000cwd.googlegro ups.com...
Hi John,

You need to insert this code, you only really need one button.

If you call that button 'btnToggle' and your list box 'lstSelection'
this code should work seamlessly when you insert it in the on click
event of your button.

Dim intSelected As Integer
Dim blnToggle As Boolean
If Me.btnToggle.Caption = "&Select all" Then
blnToggle = True
Me.btnToggle.Caption = "De&select all"
Else
blnToggle = False
Me.btnToggle.Caption = "&Select all"
End If
With Me.lstSelection
For intSelected = 0 To .ListCount - 1
.selected(intSelected) = blnToggle
Next
End With

Good luck

Nick

john wrote:
>In this single-user app I have a form with members. In the related table
I
have a field 'Select' with which the user can select a record. I have two
buttons on the form (All and None) that select either all records or
none.
Those buttons both work with an edit query. It works except for the
current
record since that is locked. To avoid that I have added code that
specifically changes the Select value of the current record by Select=-1
(or
0). It works but the only annoying thing is that after the query Access
shows a dialog box "Info has been changed" with an OK button. What can I
do
to avoid this button?
thanks,
john

Sep 7 '06 #4
I am using access 2003, and if you are using that it 'should' work.
Maybe try seeing what method are exsposed within me.lstSelection. I am
presuming that lstSelection is in actual fact a list box, rather than a
combo box?

Good luck,

Nick
john wrote:
Thanks Nick,
The first part is working but I still have trouble with:
With Me.lstSelection
For intSelected = 0 To .ListCount - 1
.selected(intSelected) = blnToggle
It doesn't do what it's supposed to. I get an error on .Listcount. Is that
the correct code?

Let me add that in this form only one record of the underlying table is
visible on the form. So there's only one checkbox visible, but i want them
to be (un)checked by pushing the button.
john

"Nick 'The database Guy'" <ni***********@eads.comschreef in bericht
news:11*********************@m73g2000cwd.googlegro ups.com...
Hi John,

You need to insert this code, you only really need one button.

If you call that button 'btnToggle' and your list box 'lstSelection'
this code should work seamlessly when you insert it in the on click
event of your button.

Dim intSelected As Integer
Dim blnToggle As Boolean
If Me.btnToggle.Caption = "&Select all" Then
blnToggle = True
Me.btnToggle.Caption = "De&select all"
Else
blnToggle = False
Me.btnToggle.Caption = "&Select all"
End If
With Me.lstSelection
For intSelected = 0 To .ListCount - 1
.selected(intSelected) = blnToggle
Next
End With

Good luck

Nick

john wrote:
In this single-user app I have a form with members. In the related table
I
have a field 'Select' with which the user can select a record. I have two
buttons on the form (All and None) that select either all records or
none.
Those buttons both work with an edit query. It works except for the
current
record since that is locked. To avoid that I have added code that
specifically changes the Select value of the current record by Select=-1
(or
0). It works but the only annoying thing is that after the query Access
shows a dialog box "Info has been changed" with an OK button. What can I
do
to avoid this button?
thanks,
john
Sep 8 '06 #5
lstSelection in fact is a checkboxfield. The underlying tablefield is a
Yes/No field. That's probably why the .listcount gives an error.
lstSelection doens't have methods in itself.
john

"Nick 'The database Guy'" <ni***********@eads.comschreef in bericht
news:11*********************@e3g2000cwe.googlegrou ps.com...
>I am using access 2003, and if you are using that it 'should' work.
Maybe try seeing what method are exsposed within me.lstSelection. I am
presuming that lstSelection is in actual fact a list box, rather than a
combo box?

Good luck,

Nick
john wrote:
>Thanks Nick,
The first part is working but I still have trouble with:
With Me.lstSelection
For intSelected = 0 To .ListCount - 1
.selected(intSelected) = blnToggle
It doesn't do what it's supposed to. I get an error on .Listcount. Is
that
the correct code?

Let me add that in this form only one record of the underlying table is
visible on the form. So there's only one checkbox visible, but i want
them
to be (un)checked by pushing the button.
john

"Nick 'The database Guy'" <ni***********@eads.comschreef in bericht
news:11*********************@m73g2000cwd.googlegr oups.com...
Hi John,

You need to insert this code, you only really need one button.

If you call that button 'btnToggle' and your list box 'lstSelection'
this code should work seamlessly when you insert it in the on click
event of your button.

Dim intSelected As Integer
Dim blnToggle As Boolean
If Me.btnToggle.Caption = "&Select all" Then
blnToggle = True
Me.btnToggle.Caption = "De&select all"
Else
blnToggle = False
Me.btnToggle.Caption = "&Select all"
End If
With Me.lstSelection
For intSelected = 0 To .ListCount - 1
.selected(intSelected) = blnToggle
Next
End With

Good luck

Nick

john wrote:
In this single-user app I have a form with members. In the related
table
I
have a field 'Select' with which the user can select a record. I have
two
buttons on the form (All and None) that select either all records or
none.
Those buttons both work with an edit query. It works except for the
current
record since that is locked. To avoid that I have added code that
specifically changes the Select value of the current record by
Select=-1
(or
0). It works but the only annoying thing is that after the query
Access
shows a dialog box "Info has been changed" with an OK button. What can
I
do
to avoid this button?
thanks,
john

Sep 8 '06 #6

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

Similar topics

2
by: Joachim Bauer | last post by:
I'm using the code below to display a menu that opens when the mouse goes over the main menu item (try it in your browser to understand the behaviour). It uses "position:absolute" and a switch...
3
by: d.schulz81 | last post by:
Hi all how can i manipulate a multiple select into a single select dropdown field with JavaScript? thanks
3
by: rh0dium | last post by:
Hi all, Another newbie question. So you can't use signals on threads but you can use select. The reason I want to do this in the first place it I need a timeout. Fundamentally I want to run a...
4
by: devine | last post by:
Hi All, I am VERY new to Javascript. I have been provided with some code, which will enable me to hide/show a text area and change a submit button dependant on a check box. <!DOCTYPE html...
2
by: mitch | last post by:
I have a <select> that's inside a <td> and I want to dynamically show and hide the select. If elem is set to the <select> and I do either of these: elem.style.visibility = "hidden";...
3
by: Beholder | last post by:
I hope that someone can help me with the following: Short background explenation: I have a shrfepoint page (newform.aspx) in a item list. On this page is a lookup column that displays a lookup...
4
by: gregincolumbus | last post by:
I am trying to get the financial calculation on this to trigger whenever there is a change to select1. Right now, the user has to click on select2 to trigger the changes. Ideally, a change of...
1
by: RichardR | last post by:
I have a webpage which has a table that contains a column with several drop down boxes (<SELECT>). The contents of the drop down boxes are dynamically populated so I have no idea what the actually...
2
by: FlashCreations | last post by:
Hello, I am trying to use javascript to validate a form that has three select inputs. Here is the form: <form name="select" action="main.php" method="post" onsubmit="return ValidateSelect(this)"> ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.