Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / September 2006

Tip: Looking for answers? Try searching our database.

Select all button issues

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gambit32 - 15 Sep 2006 17:57 GMT
I have a button on my form that selects all clients in a list box.  It
works in the sense that when I click it, it does select all clients.
The problem I'm running into is that when I first open the form the
button defaults to 'Unselect All Clients' when it should default to
'Select All Clients.'  Those are the two states of the button.  Ideally
I want to open the form and the button reads 'Select All Clients.'

My code:

Private Sub btnselectallcli_Click()
On Error GoTo Err_btnselectallcli_Click
   Dim i As Integer

If btnselectallcli.Caption = "Select All Clients" Then
   For i = 0 To listclient.ListCount - 1
       listclient.Selected(i) = True
   Next i
   btnselectallcli.Caption = "Unselect All Clients"
Else
    For i = 0 To listclient.ListCount - 1
       listclient.Selected(i) = False
   Next i
   btnselectallcli.Caption = "Select All Clients"
End If

Exit_btnselectallcli_Click:
   Exit Sub

Err_btnselectallcli_Click:
   MsgBox Err.Description
   Resume Exit_btnselectallcli_Click
   
End Sub

....thanks for all the help the group has given me!

Mark
Klatuu - 15 Sep 2006 18:15 GMT
Check the Caption property of the button in design view.

> I have a button on my form that selects all clients in a list box.  It
> works in the sense that when I click it, it does select all clients.
[quoted text clipped - 33 lines]
>
> Mark
gambit32 - 15 Sep 2006 18:30 GMT
You had it right.  Wow.  How simple.  Thanks for the quick fix and
response.
> Check the Caption property of the button in design view.
>
[quoted text clipped - 35 lines]
> >
> > Mark
Douglas J. Steele - 15 Sep 2006 18:15 GMT
Call btnselectallcli_Click in your form's Load event (after first making
sure that the caption is what you want):

Private Sub Form_Load()
  Me.btnselectallcli.Caption = "Select All Clients"
  Call btnselectallcli_Click()
End Sub

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I have a button on my form that selects all clients in a list box.  It
> works in the sense that when I click it, it does select all clients.
[quoted text clipped - 33 lines]
>
> Mark
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.