Access Query problems

J

Josephine Booth

I am trying to put together a contacts database, which
will be used to produce mailing lists. Each contact has a
number of interests e.g. environment, tourism etc. I need
to be able to create a form with check boxes, so that the
user can select the interests which they wish the mailing
list to target. The query should then search through the
database and select those contacts that have one or more
of the interests selected by the user, then make a table
of these contacts, their addresses, and the interests.
There are 3 tables involved in this query – Master
contacts and ContactInterest, linked by ContactID, and
Organisations, linked to Master Contacts via
OrganisationID.

Any help much appreciated
 
D

Dale Fye

Do you have a table of all the interests, or are they hard coded? I'd
recommend using a table, then you could create a subform to collect a
users interests (and if the list of interests ever changes, you don't
have to rewrite all your code). Additionally, with this table of
interests, you could create a sub-form on the form where the user is
creating their mailing list.

Then, when the user is done selecting the items of interest, you would
have a command button that runs a query that looks something like:

SELECT MC.*
FROM MasterContacts MC
WHERE MC.ContactID
IN(SELECT CI.ContractID
FROM ContractInterests CI
INNER JOIN Interests I
ON CI.InterestID = I.InterestID)


--
HTH

Dale Fye


I am trying to put together a contacts database, which
will be used to produce mailing lists. Each contact has a
number of interests e.g. environment, tourism etc. I need
to be able to create a form with check boxes, so that the
user can select the interests which they wish the mailing
list to target. The query should then search through the
database and select those contacts that have one or more
of the interests selected by the user, then make a table
of these contacts, their addresses, and the interests.
There are 3 tables involved in this query – Master
contacts and ContactInterest, linked by ContactID, and
Organisations, linked to Master Contacts via
OrganisationID.

Any help much appreciated
 

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