Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use buttons llike tabs, kind of.

Status
Not open for further replies.

ponderdj

MIS
Dec 10, 2004
135
US
Hello,

I have a form with a listbox, and I want to have 3 buttons under the form that change the row source of the listbox. I know how to do this, but I want the button clicked to stay down, and only go up when a different button is clicked.

The buttons are labeled:
1. Open
2. In Prgress
3. Closed

I'd like the form to open with "open" in the down position by default.

Any ideas?
Thanks

 
Hi
I think Toggle buttons would suit your purposes. You could include a line in the On Open event for your form:
[tt]Me.Toggle0 = True[/tt]
Along with the relevat code for your listbox.

Otherwise you will need to play with the appearance of a Command button.
 
How do I group the toggle buttons so that only one can be down at a time?
 
Use an Option Group and select Toggle Buttons (screen four of the wizard). You can also choose a default if you use an Option Group.
 
Thanks for the suggestions, but this is how I ended up doing it. For those interested, I used labels. Labels have a property called Special Effect. I used code similar to this:

Code:
Private Sub Form_Open(Cancel As Integer)

Call MouseDown("lblOpen", "frmEntry")
Call MouseUp("lblInProgress", "frmEntry")
Call MouseUp("lblClosed", "frmEntry")

End Sub

Private Sub lblOpen_Click()

Call MouseUp("lblClosed", "frmEntry")
Call MouseUp("lblInProgress", "frmEntry")
Call MouseDown("lblOpen", "frmEntry")

End Sub

Private Sub lblInProgress_Click()

Call MouseUp("lblOpen", "frmEntry")
Call MouseUp("lblClosed", "frmEntry")
Call MouseDown("lblInProgress", "frmEntry")

End Sub

Private Sub lblClosed_Click()

Call MouseUp("lblOpen", "frmEntry")
Call MouseUp("lblInProgress", "frmEntry")
Call MouseDown("lblClosed", "frmEntry")

End Sub
Code:
Function MouseUp(stControlName As String, FormID As String)

    With Access.Forms(FormID).Controls(stControlName)
        .SpecialEffect = 1
        .ForeColor = 0
    End With

End Function

Function MouseDown(stControlName As String, FormID As String)

    With Access.Forms(FormID).Controls(stControlName)
        .SpecialEffect = 2
        .ForeColor = 255
    End With
    
End Function

Hope this helps somebody.
David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top