Query: Return Value

S

shapper

Hello,

I have an Insert Query as follows:
INSERT INTO web_MailingList ( SubscriberName, SubscriberEmail,
SubscriberDate )
SELECT [@SubscriberName], [@SubscriberEmail], [@SubscriberDate];

My question is, can I create a Query that follows this steps:

IF there is a table record where SubscriberEmail = [@SubscriberEmail]
Then
RETURN False
Else
INSERT new record
End

Is this possible in Microsoft Access Queries?

Thanks,
Miguel
 
N

Neil Sunderland

shapper said:
I have an Insert Query as follows:
INSERT INTO web_MailingList ( SubscriberName, SubscriberEmail,
SubscriberDate )
SELECT [@SubscriberName], [@SubscriberEmail], [@SubscriberDate];

My question is, can I create a Query that follows this steps:

IF there is a table record where SubscriberEmail = [@SubscriberEmail]
Then
RETURN False
Else
INSERT new record
End

INSERT INTO web_MailingList
(SubscriberName, SubscriberEmail, SubscriberDate)
SELECT [@SubscriberName], [@SubscriberEmail], [@SubscriberDate]
WHERE NOT EXISTS
(SELECT *
FROM web_MailingList
WHERE SubscriberEmail = [@SubscriberEmail])
 

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

Top