Update Query producing "blank" records

  • Thread starter TraciAnn via AccessMonster.com
  • Start date
T

TraciAnn via AccessMonster.com

Contact table
ContactID
FirstName
LastName
etc.

Communication table
CommunicationID
ContactID
IntroEmailDate
etc.

ContactSchedule table
ContactScheduleID
ScheduleID
ContactID

I export a query which queries the ContactSchedule for all Contacts that have
a schedule but haven't received an email (Communication.IntroEmailDate = Is
Null).

I then run an update query with the same parameters to update Communication.
IntroEmailDate with the current date (Date()).

It works great for records where the ContactID is in the Communication table,
but if the ContactID doesn't exist, a record is added with just a new
Communication record with an IntroEmailDate but no ContactID to assign it to.

When I run the update, do I include:
SET Communication.ContactID = ContactSchedule.ContactID ?

Here is the current SQL:
UPDATE (Contact RIGHT JOIN ContactSchedule ON Contact.ContactID =
ContactSchedule.ContactID) LEFT JOIN Communication ON Contact.ContactID =
Communication.ContactID SET Communication.IntroEmailDate = Date()
WHERE (((Communication.IntroEmailDate) Is Null) AND ((ContactSchedule.
ContactID) Between 1 And 99999) AND ((Contact.Status)=1) AND (
(ContactSchedule.RoleID)=3) AND ((Contact.ContactEmail) Is Not Null));


Thanks in advance!!!
 
T

TraciAnn via AccessMonster.com

One other point:
When I run the update, do I include:
SET Communication.ContactID = ContactSchedule.ContactID ?

Currently Communication.ContactID allows duplicates, but it shouldn't. I will
be changing this in the next revision. I want to avoid the query update from
creating a separate Communication record.

Thanks Again!
 

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