G
Guest
I have created a form for a user to email data to a vendor. The vendor email addresses are not in a table, therefore the user must type the email address each time [this will be addressed in a new version of the application]. I have created a button on the form to email the request. I currently do some rudimentary checking - like for the @ sign and to make sure there isn't a comma in the address, but I would like to check to make sure that the email address entered is a valid one. Because the emails are being sent to outside vendors, the email address can not be verified using our company's Outlook address book.
Here is the code for what the button currently does. I use the SendObject method to send the email with the attached file
Dim sRptName As Strin
Dim sAddy As Strin
Dim sEMSG As Strin
Dim sMsg As Strin
Dim sSubject As Strin
Dim lngPos As Lon
If IsNull(Me.txtEmailAddy) The
MsgBox "You must enter an email address before clicking on the Send Button", vbInformatio
Me.txtEmailAddy.SetFocu
GoTo Exit_cmdSend_Clic
End I
lngPos = InStr(1, Me.txtEmailAddy, "@"
If lngPos > 0 The
MsgBox "The email address does not contain the @ sign, please re-enter", vbInformatio
Me.txtEmailAddy.SetFocu
GoTo Exit_cmdSend_Clic
ElseIf InStr(1, Me.txtEmailAddy, ",") > 0 The
MsgBox "The email address contains a comma, please re-enter", vbInformatio
Me.txtEmailAddy.SetFocu
GoTo Exit_cmdSend_Clic
Els
sAddy = Me.txtEmailAdd
End I
Any help would be greatly appreciated. Thank you ..
Nancy Welc
Programmer/Analyst
King County IT
Here is the code for what the button currently does. I use the SendObject method to send the email with the attached file
Dim sRptName As Strin
Dim sAddy As Strin
Dim sEMSG As Strin
Dim sMsg As Strin
Dim sSubject As Strin
Dim lngPos As Lon
If IsNull(Me.txtEmailAddy) The
MsgBox "You must enter an email address before clicking on the Send Button", vbInformatio
Me.txtEmailAddy.SetFocu
GoTo Exit_cmdSend_Clic
End I
lngPos = InStr(1, Me.txtEmailAddy, "@"
If lngPos > 0 The
MsgBox "The email address does not contain the @ sign, please re-enter", vbInformatio
Me.txtEmailAddy.SetFocu
GoTo Exit_cmdSend_Clic
ElseIf InStr(1, Me.txtEmailAddy, ",") > 0 The
MsgBox "The email address contains a comma, please re-enter", vbInformatio
Me.txtEmailAddy.SetFocu
GoTo Exit_cmdSend_Clic
Els
sAddy = Me.txtEmailAdd
End I
Any help would be greatly appreciated. Thank you ..
Nancy Welc
Programmer/Analyst
King County IT