Entering data in a form

tmarsh

tmarsh
Local time
Today, 02:20
Joined
Sep 7, 2004
Messages
89
I've been working on a database (attached) for a health trust. I think the relationships are right but I'm having a problem entering data. The subform shows the correct data but I can't figure out how to enter data using a form.

Can someone point me to a tutorial - I have searched the forums - honest!!
 

Attachments

MStef said:
Hello Marshal!
Here it is, I think it is OK now.
Thanks for that MStef. It still has the problem in that I can't put in the same course twice i.e. same course title but different date done. My relationships musn't be right, I have a 1:m staff to course that I thought was OK.
 
In TB_COURSES_DONE include the field "START_DATE" in primary key.
 
This relationship is causing your problems...
 
Last edited:
You may also want to consider normalizing your tables...

TB_Courses
Course_ID
Course
StartDate
EndDate
Venue
Trainer

TB_Staff
Staff_ID
FName
LName
etc...

TB_Courses_Done
Staff_ID
Course_ID
 
ssteinke said:
You may also want to consider normalizing your tables...

TB_Courses
Course_ID
Course
StartDate
EndDate
Venue
Trainer

TB_Staff
Staff_ID
FName
LName
etc...

TB_Courses_Done
Staff_ID
Course_ID
That's my problem I suppose, the relationships are not right. The thing is, MStef's solution worked although he changed the primary key.

Anyway, I'm trying to grasp relationships so perhaps you will bear with me a bit. In my original dbase I had tb_staff staff_id linked 1:n with tb_courses_done with staff_id and courses_done_id as a composite key. Was that not correct?

Looking at your suggested tables, how do I link them - this is always the confusing bit for me? Staff_id in tb_staff would have to go to staff_id in tb_courses_done right? But should the courses_done_id and staff_id in this table be composite? These are the things that aren't gone into in detail in tutorials and even books.

Sorry for going on about relationships in the forms forum but it's just the way it came up.
 
hi tmarsh,

My limited knowledge of this stuff is self tought, so bare with me. If i had noticed all the hard work MStef had put into fixing your database originally, i probably woudn't even have replied since I'm probably just making it more confusing to you.

One thing I've learned is that 'THERE IS ALWAYS MORE THAN ONE WAY OF DOING IT', however, setting up the tables is the most important thing and will carry over into everything else you do.

My thoughts on how I would set up your tables is based on the idea that each individual course only happens once, however, I suppose if each course was identifiable by a course number and could occur several times, it could look something like this:

TB_Course_Number
Course_Number pk
CourseName
Description

TB_Course
Course_ID pk
Course_Number
StartDate
EndDate
Venue
Trainer

TB_Staff
Staff_ID pk
FName
LName
etc...

TB_Courses_Done
Staff_ID pk
Course_ID pk
PassFail

As you can see... just another way of doing it... in your original tables you had duplicate course names in two different tables, which is always an indicator of poor table structure.

In this example you can see that I used Staff_ID and Course_ID as a composite key for the TB_Courses_Done table, but also included a field to show if the person passed or failed the course.

As for relationships, yes, just matching the words that I used for each table should give you a pretty good indicator which fields to 'relate' to each other.

But should the courses_done_id and staff_id in this table be composite?
Their is no Courses_Done_ID, the composite key taken from the two other tables IS the identification for that table. There is no need to create its own key since it's not possible for one person to take the same course, on the same date, more than one time.

Hope this helps,

Scott
 
Thanks for that ssteinke. Please take another look and let me know if I've linked the tables OK. If I have then it must be underlying code that I'm missing because I still can't get the form to work.
 

Attachments

Users who are viewing this thread

Back
Top Bottom