Reset Command Button

G

Guest

I have a command button on a form that opens a pop-up form. When the command
button is clicked it stays depressed until it is used again. I have tried
refreshing and repainting the form after the pop-up form closes. Here's the
code:
Private Sub NMFind_Click()
On Error GoTo Err_NewAssetBtn_Click
Dim stDocName As String
'open form to find NM
If IsNull(Me!EquipTransaction) Then
stDocName = "NMForm"
'open the form
DoCmd.OpenForm stDocName, _
windowmode:=acDialog
End If
'wait for the form to be closed
If IsLoaded("NMForm") Then
DoCmd.Close acForm, "NMForm"
End If

Exit_NewAssetBtn_Click:
Exit Sub

Err_NewAssetBtn_Click:
MsgBox Err.Description
Resume Exit_NewAssetBtn_Click

End Sub
 
R

Rick B

Pressing a button should not do this. Are you sure you have a command
button, and not a toggle button?
 
G

Guest

Thank you for pointing out the obvious. It was a toggle button.
Same code in a new command button works like a charm.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top