I'm trying to conduct a duplicate email check on my database, and I have this on my form submission event:
rsEmailList = SPEmailCheck(Trim(Request.Form("EMail")))
If rsEmailList = 52016 Then MsgBox("Please input an email address not already in use")
My function for SPEmail check is:
oCmd.CommandText = "[spEmailCheck]"
oCmd.Parameters.Append oCmd.CreateParameter("pEmail", adVarChar, adParamInput, 255, cEmailAddress)
oCmd.Parameters.Append oCmd.CreateParameter("pMsg", adInteger, adParamOutput)
SPEmailCheck = oCmd.Parameters("pMsg")
DeleteAllParms
And the stored procedure is:
CREATE OR ALTER PROCEDURE [dbo].[spEmailCheck]
@pEmail NVARCHAR(255),
@pMsg INT OUT
AS
IF EXISTS(SELECT 1 FROM [dbo].[Address] WHERE [Addr_EMail] = @pEmail AND [Address_Type] = 'U')
BEGIN
SET @pMsg = 52016 --Email address already exists and is associated with another profile.
RETURN
END
I've confirmed by manual execution that the procedure works as intended. I can't seem to get the message box to trigger. My inetpub logs show error "Object_required:_'rsEmailList'" for the line that sets the SPEmailCheck on my event.
Also have an issue with the MsgBox being denied permission to do what it's supposed to when I try to trigger that separately, but that's another issue that I can address once I've figured out how to conduct this check correctly.