checkbox query

R

Robert Painter

Hi. Very new to access. Friend wants me to create from scratch db for his
recruitment and manpower agency. All going well with Employee details using
one table and even managed to do query for driver licence expiry dates for
next month ahead ok. Then came the bombshell: Each employee has different
work experience like general warehouse, forklift driver, order picker but
not warehouse manager, warehouse supervisor, warehouse team leader etc. I
then created a 2 page form with employee details on page 1 and check boxes
for work experience on page 2. Is there any way to do a query to find some
one who has experience required. My project has ground to a halt and I now
find the work experience sheet given to me has five sections (so will need
yet another page at least) of INDUSTRIAL (22 options) COMMERCIAL (15),
ACCOUNTING (13), DRIVING (6) and COMPUTER LITERACY (9).
I had thought of a similar form to compare which can be changed to suit
skills queried but am now way out my depth.
Any ideas welcome
 
B

Beetle

Access is a very useful program, but it has a steep learning curve, so here are
a few things you should consider before you go down this road;

1) Is your friend in no particular hurry to get this done? And are they
willing
to be very patient while you go through this process?

2) You are going to need to invest a *considerable* amount of your own
time in order to get this right. Are you willing to do that for free?

3) If you are not willing to do it for free, are they willing to pay you for
your time?

If the answer to any of the above questions is no, then I recommend you advise
your friend to consult a professional Access developer in your area.

If you are going to proceed with the project, then I recommend you do some
research on proper table normalization, as you current approach is not
going to work. Here are some online resources that can help you in that
regard. You should start with the tutrial by Crystal;

Tutorial by Crystal:
http://www.allenbrowne.com/casu-22.html

Jeff Conrad's Access page:
http://www.accessmvp.com/JConrad/accessjunkie.html

The Access Web:
http://www.mvps.org/access/
 
K

Ken Sheridan

You should try and think of how a relational database stores this sort of
data rather than how you'd represent it on a paper form. Relational
databases store data in only one way, as values at column positions in rows
in tables. If you have a separate column in a table for every type of work
experience you are departing from this fundamental principle. Its what's
known as 'encoding data as column headings'.

The way a relational database works is to represent each 'entity' type by a
table, whose columns represent attributes of that entity type. So an
Employees table will have columns EmployeeID, FirstName, LastName etc.
Another important principle is that tables contain no 'redundancy', i.e. each
fact is stated once and once only. This is achieved by having separate
tables related to each other by means of a foreign key column in one
referencing the primary key column in another. So a Cities table might be
related to a States table, and an Addresses table to the Cities table, but
the Addresses table would not include a State column as once you know the
City you know the State via the relationships. To be told 20 times in an
Addresses table that San Francisco is in California would be redundancy, to
be told it only once in the Cities table is not.

With your scenario you already have an Employees table, which presumably has
a primary key column such as EmployeeID. If not add an autonumber column as
the primary key.

For work experience you have two entity types, ExperienceCategories
(Industrial, Commercial etc), and WorkExperiences, each of which will be in
one experience category. So you need tables of those names, each with its
own primary key column, which again can be an autonumber, and in
WorkExperiences a foreign key column, ExperienceCatgoryID, which references
the primary key column of the same name in ExperienceCategories.

You now have to relate Employees to WorkExperiences. What you have here is
a many-to-many relationship type as each employee can have one or more work
experience, and each work experience can apply to one or more employees. A
many-to-many relationship type is not created directly between the two tables
but via a third table, EmployeeExperiences. This would have two foreign key
columns, EmployeeID and WorkExperienceID referencing the keys of the other
two tables respectively. The primary key of this table would be a composite
one made up of the EmployeeID and WorkExperienceID columns, which in
combination must be unique within then table. The EmployeeExperiences table
might also have other columns representing attributes of each employee's
particular work experience, e.g. the dates between which they had that
particular experience. Its for you to judge what attributes are needed for
this table, however.

For data entry you'd normally have an Employees form and within it a subform
based on the EmployeeExperiences table. Entering each work experience for an
employee is then simply a case of inserting a new record in the subform,
selecting from a list of work experiences in a combo box. The experience
category would be shown in an unbound control, but you can select a category
first, then select an experience from a combo box listing only those
experiences for the category in question. You'll find a demo of ways of
doing this at:


http://community.netscape.com/n/pfx...yMessages&tsn=1&tid=23626&webtag=ws-msdevapps


It uses the local administrative areas of County, District and Parish in my
area, but the principles are exactly the same.

When it comes to querying for employees with particular experiences it is a
simple task to find all employees with one particular work experience such as
forklift driver as you'd just join the tables in a query and put a criterion
on the relevant WorkExperienceID column. Querying for employees with several
different work experiences is more complex. In essence it involves seeing
how many rows for a particular employee exist in EmployeeExperiences where
the experience is any of those required, and then seeing if the number of
rows equals the number of experiences required. The following query for
example will return those employees who have all of experiences 3, 42 and 99:

SELECT EmployeeID
FROM EmployeeExperiences
WHERE WorkExperienceID IN(3, 42, 99)
GROUP BY EmployeeID
HAVING COUNT(*) =
(SELECT COUNT(*)
FROM WorkExperiences
WHERE WorkExperienceID IN(3, 42, 99));

In reality you would allow for the user to input the list of required
experiences at runtime rather than hard coding them in the query.

You say you are very new to Access, so I imagine that you are going to find
some of the above difficult to take in at this stage. As the other
respondent has said, you need to consider whether you and your friend are
prepared to invest time and effort in getting to a level where you are able
to implement the sort of solutions which an application of this nature
demands. Its by no means a trivial task.

Ken Sheridan
Stafford, England
 
R

Robert Painter

Hi Ken
Think you are both correct. It is very difficult. Have tried and tried to
get to grips with your
suggestions but still failing. Managed to get tables sorted and
relationships i think but only getting confused so have informed my friend
to go and buy one. His reply was that had already sourced but most of db
would be wasted as he only requires the 2 functions ie list of employees
with experience and reminders of licence renewal dates. Seems a shame kuz i
have managed to sort out the licence thing. Still not to worry

Thanks for your reply

Robert
 

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