Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Indiana, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Command Buttons (Access 97 SR2)

    Just a simple question. I have a button on a form that when clicked opens a subform. The text on the button says "Open Subform". I would like to have the text on the button read "Close Subform" after the subform opens. TIA

  2. #2
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Columbus, Ohio, USA
    Posts
    286
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command Buttons (Access 97 SR2)

    Lonnie: Try this. Assume the name of the Command button is btnCommand.

    Private Sub btnCommand_Click()
    On Error GoTo btnCommand_Error

    If btnCommand.Caption = "Open Form" Then
    DoCmd.OpenForm (formname)
    btnCommand.Caption = "Close Form"
    Else
    DoCmd.Close
    btnCommand.Caption = "Open Form"
    End If

    Exit Sub

    btnCommand_Error:
    MsgBox Err.Description
    Exit Sub

    End Sub

    HTH.

  3. #3
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Indiana, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command Buttons (Access 97 SR2)

    Thanks, Bill. I was able to do what I needed by using your example.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •