active buttons in access after others are completed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to make a button on a form active after other fields are
completed?
 
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
 
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.
 

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

Back
Top