I'm using the following code to send e-mails from a button on a form. Sometimes it works fine, sometimes it stops with the message "invalid use of null" and sometimes it crashes Access! (as per details below). Any help would be much appreciated. Thanks. PS: I'm not proficient in VB, I cobbled this routine together from info on the forum.
Private Sub send_email_Click()
On Error GoTo Err_send_email_Click
Dim stDocName As String
Dim email As String
Dim esubj As String
stDocName = Me.txtmessage
email = Me.E_Mail
esubj = Me.subj
DoCmd.SendObject , , , email, , , esubj, stDocName, True
Exit_send_email_Click:
Exit Sub
Err_send_email_Click:
MsgBox Err.Description
Resume Exit_send_email_Click
End Sub
MSACCESS caused an invalid page fault in
module KERNEL32.DLL at 018f:bff7a138.
Registers:
EAX=02eb8004 CS=018f EIP=bff7a138 EFLGS=00010216
EBX=0ab3ffa8 SS=0197 ESP=00626a00 EBP=00626a40
ECX=57565553 DS=0197 ESI=0ab3f37c FS=5c07
EDX=0b4438bb ES=0197 EDI=02eb8c30 GS=0000
Bytes at CS:EIP:
89 51 08 8b 53 08 8b 43 04 89 42 04 8d 93 0b 10
Stack dump:
00626a40 00000c2c 0ab3f0a8 000002d4 bff7a3a0 0aa40000 0ab3f37c 00000c2c 00000000 0aa4000c 0aa40000 0ab3f0a8 00000040 00000000 0000ab3f 0000ab40
Private Sub send_email_Click()
On Error GoTo Err_send_email_Click
Dim stDocName As String
Dim email As String
Dim esubj As String
stDocName = Me.txtmessage
email = Me.E_Mail
esubj = Me.subj
DoCmd.SendObject , , , email, , , esubj, stDocName, True
Exit_send_email_Click:
Exit Sub
Err_send_email_Click:
MsgBox Err.Description
Resume Exit_send_email_Click
End Sub
MSACCESS caused an invalid page fault in
module KERNEL32.DLL at 018f:bff7a138.
Registers:
EAX=02eb8004 CS=018f EIP=bff7a138 EFLGS=00010216
EBX=0ab3ffa8 SS=0197 ESP=00626a00 EBP=00626a40
ECX=57565553 DS=0197 ESI=0ab3f37c FS=5c07
EDX=0b4438bb ES=0197 EDI=02eb8c30 GS=0000
Bytes at CS:EIP:
89 51 08 8b 53 08 8b 43 04 89 42 04 8d 93 0b 10
Stack dump:
00626a40 00000c2c 0ab3f0a8 000002d4 bff7a3a0 0aa40000 0ab3f37c 00000c2c 00000000 0aa4000c 0aa40000 0ab3f0a8 00000040 00000000 0000ab3f 0000ab40