View Full Version : To enable buttons


sofie
01-18-2002, 03:26 AM
I thougt this was the code, to enable a button, when there is no previous or next button. But it doesn't work.

Who can help me?

Private Sub Form_current()
If IsNull(Me.Code) Then
cmdPrevious.SetFocus
cmdNext.Enabled = False
Else
cmdNext.Enabled = True
End If
End Sub

Ernie Taylor
01-21-2002, 07:54 AM
Why not make the button invisible if your answer is true. Doing it this way seems easier. The code below checks if a record has been updated (flag control set to true) and then prevents further updates by making the update button (called readonly) invisible.
If flag Then
Me.Form.AllowEdits = False
Me![readonly].Visible = True
Else
Me.Form.AllowEdits = True
Me![readonly].Visible = False
End If