Send Object Query

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

Guest

I have set up my access to email confirmation of registration with help from
here, i have a problem with send object here isthe problem code

DoCmd.SendObject _
acSendQuery, "Email_query", acFormatTXT, _
[EmailName], _
[PDN_Email], _
[Managers_Email],

it works fine normally, but if i do not have [PDN_email] or
[Managers_Email], there is an error, i think this is something simple, but
how do i make it send if either field is blank, thanks for any help

Phil
 
Hi Phil,

Use the Nz function to convert nulls to zero length strings. For example:

Option Compare Database
Option Explicit

Private Sub cmdSendMessage_Click()
On Error GoTo ProcError

DoCmd.SendObject _
acSendQuery, "Email_query", acFormatTXT, _
[EMailName], _
Nz([PDN_Email], ""), _
Nz([Managers_Email], "")

ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, , _
"Error in cmdSendMessage_Click event procedure..."
Resume ExitProc
End Sub


If my answer has helped you, please answer yes to the question that reads
"Did this post answer the question?" at the bottom of the message thread.


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

I have set up my access to email confirmation of registration with help from
here, i have a problem with send object here isthe problem code

DoCmd.SendObject _
acSendQuery, "Email_query", acFormatTXT, _
[EmailName], _
[PDN_Email], _
[Managers_Email],

it works fine normally, but if i do not have [PDN_email] or
[Managers_Email], there is an error, i think this is something simple, but
how do i make it send if either field is blank, thanks for any help

Phil
 

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

Similar Threads


Back
Top