Refresh a command button on an unbound form

H

Home School Mom

I have an unbound "Main Form" with several command buttons which simply open
up other forms or reports. When I click a command button (for instance, Edit
Staff Details), it opens up a data entry form and when I close the data entry
form, the Edit Staff Details button on the Main Form seems to be frozen. I
have to either close and re-open the Main Form or click any another command
button, (which opens another form) and then close that form before the Edit
Staff Details button will work again. Is there a way to refresh the command
button or to make sure that it is repeatedly available? Thanks!
 
V

Van T. Dinh

That is not the normal behaviour of a CommandButton. When you click a
CommandButton, it simply executes the CommandButton_Click Event. Unless you
have erroneous code somewhere that disables the CommandButton, it shouldn't
freeze.

Post the CommandButton_Click Event code.
 
H

Home School Mom

Thanks Van,

Thanks for helping! I'm a self-taught programmer, so I may be missing
something really obvious. By the way, the button opens a small password form
initially and then goes on to open the form if the correct password is input.
Here's my code:

Private Sub EditStaffButton_Enter()
On Error GoTo Err_EditStaffButton_Click

Dim stDocName As String
' Dim stLinkCriteria As String

stDocName = "PasswordEditStaff"
DoCmd.OpenForm stDocName
', , , stLinkCriteria

Exit_EditStaffButton_Click:
Exit Sub

Err_EditStaffButton_Click:
MsgBox Err.Description
RefreshDatabaseWindow
Resume Exit_EditStaffButton_Click

End Sub
 
V

Van T. Dinh

The code looks fine.

Use the Debug window to check the Enabled Property of the CommandButton. It
sounds like there is some code that disables the CommandButton and then
enables it again in the process.
 
Top