D
DebbieG
I copied some code from another database and I can't get it to work in my
new database. The SAVE button on my form is not visible. I want it to be
visible when the record is dirty. If the record is dirty and I press the
ESC key, I want it to be invisible. And if I save the record, I want it to
be invisible. Here is my code:
Private Sub Form_Current()
cmdSave.Visible = False
End Sub
Private Sub Form_Dirty(Cancel As Integer)
Me.cmdSave.Visible = True
End Sub
Private Sub Form_Timer()
Dim fDirty As Boolean
fDirty = Me.Dirty
If Not (fDirty Eqv cmdSave.Visible) Then
cmdSave.Visible = fDirty
End If
End Sub
The timer interval is set to 250. The visible property on the SAVE button
is set to NO.
The ESC key is working great. But when I click SAVE I get:
Run-time error '2165'
You can't hide the control that has the focus.
I am missing something but can't seem to find it. Like I said, it works
fine in my other database. I've searched everywhere I know, looked in all
my manuals, but can't find where I found this code in the first place.
Thanks in advance for any help.
Debbie
new database. The SAVE button on my form is not visible. I want it to be
visible when the record is dirty. If the record is dirty and I press the
ESC key, I want it to be invisible. And if I save the record, I want it to
be invisible. Here is my code:
Private Sub Form_Current()
cmdSave.Visible = False
End Sub
Private Sub Form_Dirty(Cancel As Integer)
Me.cmdSave.Visible = True
End Sub
Private Sub Form_Timer()
Dim fDirty As Boolean
fDirty = Me.Dirty
If Not (fDirty Eqv cmdSave.Visible) Then
cmdSave.Visible = fDirty
End If
End Sub
The timer interval is set to 250. The visible property on the SAVE button
is set to NO.
The ESC key is working great. But when I click SAVE I get:
Run-time error '2165'
You can't hide the control that has the focus.
I am missing something but can't seem to find it. Like I said, it works
fine in my other database. I've searched everywhere I know, looked in all
my manuals, but can't find where I found this code in the first place.
Thanks in advance for any help.
Debbie