I would suggest doing it differently (I'll explain that), but I'll also show you how to do it your way.
Your way:
The button's click event handler is actually a function you can call! For example, if the VBA for the button is:
Code:
Private Sub Command1_Click()
'code that does email stuff is here
End Sub
Then you can simply call "Command1_Click". However, if you have a continuous form, and you have multiple instances of the same button, it won't work as desired.
EDIT:
On second thought, if this is a continuous form, calling "Command1_Click" will call the first instance. So if you remove the row after the email is sent, then you can add a button to the header ("Mail all" or something):
Code:
Private Sub cmdMailAll_Click()
While Form.Recordset.RecordCount > 0
cmdMailReport_Click
Form.Requery
Wend
End Sub
I know I already said this, but just to be safe: in order for this to work, you MUST remove the row after the email is sent. Otherwise you will spam the first one forever. Also Form.Requery is required (same reason).
/EDIT
My Suggestion:
Rewrite the mail function to take a parameter that indicates which report to mail (use a primary key or other unique identifier). Example:
Code:
Sub MailDaReportYo(ReportID as Integer)
and then just call that in a loop that iterates all the rows in your split form.
Hope that helps. If you provide more detail or a database file, I can help further.
EDIT #2:
Lol, so many edits.

Originally Posted by
csn102
Code:
public function clickButton(btn as Control) as boolean btn.value = true
end function
This might work (untested):
Code:
public function clickButton(btn as Control) as boolean
Run( btn.Name & "_Click" )
end function
Simply takes your button's name and adds "_Click" to it, then runs that as a function.
/EDIT