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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide or show control when form opens 2

Status
Not open for further replies.

ad2

Technical User
Dec 31, 2002
186
US
Hi,

When a form opens and the subject id field is blank, I want a command button to be hidden. If the subject id is filled in I want the button to show. The code I have below is not working - the button is visible if the subject id is blank or is filled in. Any ideas?

Thanks,
Ad2


'Private Sub Form_Load()
' If IsNull(SubID) Then
' cmdReport.Visible = False
' Else
' cmdReport.Visible = True
' End If
'End Sub
 
(Note this isn't anything to do with an answer to your question, its already answered anyway!)

Just a little info when your posting, use [ignore]
Code:
[/ignore] to start writing code, and [ignore]
[/ignore] to finish the code. An example:

[ignore]
Code:
Private Sub Form_Load()
    If IsNull(SubID) Then
     cmdReport.Visible = False
    Else
     cmdReport.Visible = True
    End If
End Sub
[/ignore]

will look like this:
Code:
Private Sub Form_Load()
    If IsNull(SubID) Then
     cmdReport.Visible = False
    Else
     cmdReport.Visible = True
    End If
End Sub
This makes it easier for people to see/copy code, and also stops confusion especially as you used comments (') to show your code.

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top