active buttons in access after others are completed

B

Brendan Reynolds

I'm not quite sure whether you want to enable the button or set the focus to
it. Hopefully this example should help either way ...

Private Sub Text0_AfterUpdate()
ToggleEnabled
End Sub

Private Sub Text2_AfterUpdate()
ToggleEnabled
End Sub

Private Sub ToggleEnabled()
If Len(Trim$(Me.Text0 & vbNullString)) > 0 _
And Len(Trim$(Me.Text2 & vbNullString)) > 0 Then
Me.Command4.Enabled = True
Me.Command4.SetFocus
Else
Me.Command4.Enabled = False
End If
End Sub
 
O

Ofer

Create a function in the form

Function CheckFields()
If isnull(Field1) or isnull(Field2) or isnull(Field3) then
me.buttonName.visible = false
else
me.buttonName.visible = true
end if
End function

Call this function from the after update event of each field that the
function is checking
Also call it form the on current event of the form.
 
Top