Share via

VBA to hide a button

Anonymous
2018-04-27T01:08:31+00:00

Hello, I need help in writing a VBA code to hide a button on a form if there are already records on the forms. This is to prevent users from accidentally clicking twice. To make btnStart invisible if there are records already on frmTest and visible if there are no records on the form.

FrmTest

btnStart

Thank u in advance.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2018-04-27T01:26:40+00:00

Try this:

Private Sub Form_Open(Cancel As Integer)
If Me.Recordset.RecordCount = 0 Then
    Me.cmd1.Visible = True
Else
    Me.cmd1.Visible = False
End If
End Sub

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful