View Full Version : Queries using column headers


Veralidaine
03-26-2009, 07:39 PM
I've looked though this forum and over the net but can't seem to find exactly what I'm looking for, maybe I'm searching for the wrong thing, and I have been stumped for sometime.

I'm trying to do an employee database, I've been able to do the basic personal history on one tab, a job history on the second tab using a continuous form, its the third one that has me confused as to how to get it to work.

What I'm trying to do is:
The user looks up an employee
They go to the training tab
They can see which training the employee should have done and the date they did it (A blank date means it has not been done yet)

I currently have:
1. A table with a job history of all employees (which works for tab 2) (shows their current position for checking what training they need)
2. A table with a field called training and a field called date complete- this is the table I want to display on my form (like the history it will be displayed as a continous form) (this table is the information I want to display)
3. Another table with the positions and types of training (I have tried the talbe in both configurations- positon as the rows and training as the column headers and vice versa so I can do it either way) the fields are all just yes/no boxes where it be can be ticked if the postions need that kind of training. (the table to check against)

My thought was to find the position down the first column, then display all columns were yes is ticked as training needed- using that as the link to get the dates from the last table. I just can't do this.

I'm happy to change the layout of the tables- I just need the basic end information and a way to check which training a position should have as they are not all the same, the only other issue- more postions and training may get added in the future, so it needs to be easy to expand the tables and understandable by people who may not be very literate with computers.

Guus2005
03-27-2009, 03:31 AM
I have a light green blue-ish feeling that your database is not properly normalised.
When a person didn't do some kind of training, there shouldn't be a record.

You want the database "easy to expand the tables".
When you have normalised the database properly, that shouldn't be a problem.

Could you post a zipped sample database?

HTH:D

Veralidaine
03-29-2009, 04:33 PM
Thanks for the advise, the thing is I need a record to show when they have not done anything, thats the point.

I want a record to show when they have not done training, this will show that it has not been done.

For example, under the training tab

Training......Date Complete
Type 1.......xxxx
Type 2.......xxxx
Type 5.......xxxx
Type 8
Type 11
Type 13.....xxxx

So by looking at this the person arranging training courses can see that there is no date for type 8 and 11 meaning that it has not been done yet and should be looked at.

So this role would not need to do training types 3, 4, 6 ,7 ,9 ,10 or 12 which is why they would not appear in the list.

Currently I have the three tables (that are relevant to this part- the data base has much more in it that just this)- JobHistory (use to find the current positon), TrainingHistory (has employee number column, training column (ie just the types that they need for their current position) and finally a table that is pretty much a nice big check list (Training) (the columns/rows are the postions in the company (no employee details- its just a check list) and what training the position needs).

So the table is just:

Position......Training 1......Training 2......Training 3......Training 4.......etc
Postion 1....Yes/No box....Yes/No Box....Yes/No Box....Yes/No Box
Postion 2....Yes/No box....Yes/No Box....Yes/No Box....Yes/No Box
Postion 3....Yes/No box....Yes/No Box....Yes/No Box....Yes/No Box

(I have also tried switching Postions and Training so that Position is in the column)

Using the Job History table I see that the employee I'm searching on is currently in Position 2, so I want to then look at the Training Table (table above)- I see that using the Yes/No Box that they should have done Training 1, 2, 5, 8, 11 and 13 (as per the first example) as they are ticked as yes against Position 2. So using the last table I display to screen the results as shown in the first example to check that they have all been completed.

Technically I would just be displaying the TrainingHistory table, but I need to get the information into it to show what the employee should be undertaking and what they have undertaken.

I can get the actual database on here, but I'll need to take out the rest of the data as it will get too big otherwise, because this is just one part of the whole database.

Guus2005
03-30-2009, 11:54 PM
What you need is a table (PersonTraining) to store NameID and TrainingID
Another table (TrainingComplete) will be used to store the date that a training was done and perhaps whether is was completed with success. If this table (TrainingComplete) doesn't have a record for NameID X and TrainingID Y, then X didn't complete training Y.

The table you suggest:
Position......Training 1......Training 2......Training 3......Training 4.......etc
Postion 1....Yes/No box....Yes/No Box....Yes/No Box....Yes/No Box
Postion 2....Yes/No box....Yes/No Box....Yes/No Box....Yes/No Box
Postion 3....Yes/No box....Yes/No Box....Yes/No Box....Yes/No Box
Should in fact be a form based on a query.

HTH:D

HTH:D

neileg
03-31-2009, 02:12 AM
You design isn't normalised. You should have a table that holds all the types of training, a table for employees and a junction table that joins the two holding the date of training and any other data. You can then query the data to show the training types that don't have an entry in the junction table.