hi....i create a command button using the code shown below:

Private Sub Command3_Click()
Form5.Show
'sum action needed here to detect user's action
Command3.Caption = "Unhide History"
Unload Form5
End Sub

I need to change the caption to unhide history once the user had pressed unhide button

is this what you want to do?

If Form5.Visible = True Then
Command3.Caption = "Unhide History"
Unload Form5
Else
Form5.Show
Command3.Caption = "Hide History"
End If
Private Sub Command1_Click()
If Command1.Caption = "Hide History" Then
    Unload Form2
    Command1.Caption = "UnHide History"
Else
    Form2.Show
    Command1.Caption = "Hide History"
End If
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.