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!

Can you change the label of a VBYesNO command button? 2

Status
Not open for further replies.

testkitt2

Technical User
Apr 28, 2004
193
US
Hello to all...

I have a DB where I'm using a VBYesNO command and I want to change its label from Yes..NO... to something like Dept600 and Dept650 respectfully.. Is there anyway to do this ?

Any help or suggestions are appreciated.

Thank you
JZ

Testkitt2
 
Thank you ZmrAbdulla
I downloaded the link you gave me and changed the code to
fit my DB and it's definitely what I wanted.
This is what I ended up with:
The code here uses 2 forms
frmmain:
Code:
Private Sub cmdDepartment_Click()
    On Error GoTo Err_cmdDepartment_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmMessage"
    DoCmd.Close
    DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog, "Click To View Spending"
    

Exit_cmdDepartment_Click:
    Exit Sub

Err_cmdDepartment_Click:
    MsgBox Err.Description
    Resume Exit_cmdDepartment_Click

End Sub
frmMessage:
on open
Code:
Private Sub Form_Open(Cancel As Integer)
    Select Case Me.OpenArgs
    Case Is = "Click To View Spending"
        With Me
            .Caption = "Departmental Spending"
            .lblMessage.Caption = "Choose The Dept To View and" & _
                                  " Select appropriate button..."
            .Command1.Caption = "Dept 600"
            .Command2.Caption = "Dept 650"
            .Command3.Caption = "Cancel"
            .txtIcon = "$"
            .txtIcon.ForeColor = vbGreen

        End With
  

    End Select
End Sub
each button on click event:
Code:
Private Sub Command1_Click()
    Select Case Me.OpenArgs
    Case Is = "Click To View Spending"
        'Do Something here
    DoCmd.Close
    Dim stDocName600 As String
    Dim stLinkCriteria As String


    stDocName600 = "SpendingView600"
    
    DoCmd.OpenForm stDocName600, , , stLinkCriteria
   
   

    End Select

End Sub
and so on for command2 and command3

Thanks a whole lot...this def did the trick..

lots of thanks
this thread is complete
JZ


Testkitt2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top