'firing' a Button!

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

Guest

Hello!

I use to know how to do this, but I have forgotten!! I have an event
procedure on a form for a textbox (txtBox_GetFocus). When this control 'gets
the focus' (in the txtBox_GetFocus event), I want it to 'fire' a Button
(cmdButtonOne) on the same form to to something. Something similar to this:

Sub txtBox_GetFocus()
Me![cmdButtonOne].Click ! Of course, this doesn't work - need HELP!
End Sub
 
Soddy said:
Hello!

I use to know how to do this, but I have forgotten!! I have an event
procedure on a form for a textbox (txtBox_GetFocus). When this control 'gets
the focus' (in the txtBox_GetFocus event), I want it to 'fire' a Button
(cmdButtonOne) on the same form to to something. Something similar to this:

Sub txtBox_GetFocus()
Me![cmdButtonOne].Click ! Of course, this doesn't work - need HELP!
End Sub
 
Soddy

Try something like:

Call cmdButtonOne_Click()

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Assuming the button's On Click event property is an event procedure call the
procedure:

Sub txtBox_GetFocus()

cmdButtonOne_Click

End Sub

If it’s a macro then you'd run the macro with the RunMacro method of the
DoCmd object:

DoCmd.RunMacro "YourMacro"

If it’s a function you'd call the function:

Dim retVal

retVal= YourFunction()

Ken Sheridan
Stafford, England
 

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