Command Buttons (1 Viewer)

Purdue15

Registered User.
Local time
Today, 00:40
Joined
Jun 12, 2013
Messages
29
Hello world,

I have two command add buttons on my form that go to two seperate tables. I also have a go to next record button as well. Is there a way that I can put all three commands under one command button? They are already coded in VBA and all work properly individually, I just want to make it smoother if possible thanks
 

rzw0wr

I will always be a newbie
Local time
Today, 03:40
Joined
Apr 1, 2012
Messages
489
No, I don't think you can.
No way for the command button to know what you want to do.

Dale
 

MarkK

bit cruncher
Local time
Today, 00:40
Joined
Mar 17, 2004
Messages
8,178
Yes, a command button raises an event that is handled by your code, and that subroutine is code that other subroutines can call, so consider this code . . .

Code:
private sub cmd1_click()
  msgbox "you clicked cmd1"
end sub

private sub cmd2_click()
  msgbox "you clicked cmd2"
end sub

private sub cmd3_click()
  msgbox "you clicked cmd3"
end sub

private sub cmd4_click()
[COLOR="Green"]' this routine calls the other three routines
' effectively doing the same job as if you clicked
' all three button
[/COLOR]  cmd1_click
  cmd2_click
  cmd3_click
end sub
. . . and see how cmd4_click runs the other three routines?
 

Users who are viewing this thread

Top Bottom