I have the following situation:
- a table of employees, keyed on employee-id;
- a table of training sessions, keyed on session-id;
- a requirement to log who was present at which session, plus optional
extra textual information (e.g. "left early due to illness").
The solution I had in mind was:
1) create a presence table, keyed on employee-id and session-id,
containing a 'present' yes/no field and a comment text field;
2) cross-join employees and sessions; (this gives a record-set with all
the occasions someone could have attended);
3) left outer-join the result of (2) on the presence table, joining on
both employee-id and session-id; in principle entering presence data
should cause a new record to be created with the two foreign keys;
4) couple the result of (3) as a subform of a session form, with the
subform coupled on session-id.
The result would thus be a form with information about the session; it
has a subform with a list of employees and a 'present' field against
each, and the user can run through the list, ticking off everyone who
was present at that session. (The total number of employees is only
around 30, so this is perfectly feasible for the user.)
All fine and dandy except for one thing - the record-set resulting from
step (3) is non-updateable.
How do I get an updateable record-set? Or am I barking up the wrong tree
completely, and need to tackle it differently?
--
Stephen Poley 7 2995
You need a third table to handle this common many-many situation.
tblEmployee
EmpID -primary key
employee name.......
tblTraining
TngID -key
tblClassAttendance
ClassID -primary key
ClassDate
EmpID - foreign key
TngID - foreign key
-Ed
"Stephen Poley" <sb******************@xs4all.nl> wrote in message
news:m6********************************@4ax.com... I have the following situation: - a table of employees, keyed on employee-id; - a table of training sessions, keyed on session-id; - a requirement to log who was present at which session, plus optional extra textual information (e.g. "left early due to illness").
The solution I had in mind was: 1) create a presence table, keyed on employee-id and session-id, containing a 'present' yes/no field and a comment text field; 2) cross-join employees and sessions; (this gives a record-set with all the occasions someone could have attended); 3) left outer-join the result of (2) on the presence table, joining on both employee-id and session-id; in principle entering presence data should cause a new record to be created with the two foreign keys; 4) couple the result of (3) as a subform of a session form, with the subform coupled on session-id.
The result would thus be a form with information about the session; it has a subform with a list of employees and a 'present' field against each, and the user can run through the list, ticking off everyone who was present at that session. (The total number of employees is only around 30, so this is perfectly feasible for the user.)
All fine and dandy except for one thing - the record-set resulting from step (3) is non-updateable.
How do I get an updateable record-set? Or am I barking up the wrong tree completely, and need to tackle it differently?
-- Stephen Poley
Er, yes - that was my step 1. But having created it, how do I get
records into it?
On Fri, 24 Feb 2006 12:26:09 -0500, "Ed Robichaud" <ed*********@wdn.com>
wrote: You need a third table to handle this common many-many situation.
tblEmployee EmpID -primary key employee name.......
tblTraining TngID -key
tblClassAttendance ClassID -primary key ClassDate EmpID - foreign key TngID - foreign key
-Ed
"Stephen Poley" <sb******************@xs4all.nl> wrote in message news:m6********************************@4ax.com.. .I have the following situation: - a table of employees, keyed on employee-id; - a table of training sessions, keyed on session-id; - a requirement to log who was present at which session, plus optional extra textual information (e.g. "left early due to illness").
The solution I had in mind was: 1) create a presence table, keyed on employee-id and session-id, containing a 'present' yes/no field and a comment text field; 2) cross-join employees and sessions; (this gives a record-set with all the occasions someone could have attended); 3) left outer-join the result of (2) on the presence table, joining on both employee-id and session-id; in principle entering presence data should cause a new record to be created with the two foreign keys; 4) couple the result of (3) as a subform of a session form, with the subform coupled on session-id.
The result would thus be a form with information about the session; it has a subform with a list of employees and a 'present' field against each, and the user can run through the list, ticking off everyone who was present at that session. (The total number of employees is only around 30, so this is perfectly feasible for the user.)
All fine and dandy except for one thing - the record-set resulting from step (3) is non-updateable.
How do I get an updateable record-set? Or am I barking up the wrong tree completely, and need to tackle it differently?
-- Stephen Poley
--
Stephen Poley
Any suggestions?
On Fri, 24 Feb 2006 17:37:57 +0100, Stephen Poley
<sb******************@xs4all.nl> wrote: I have the following situation: - a table of employees, keyed on employee-id; - a table of training sessions, keyed on session-id; - a requirement to log who was present at which session, plus optional extra textual information (e.g. "left early due to illness").
The solution I had in mind was: 1) create a presence table, keyed on employee-id and session-id, containing a 'present' yes/no field and a comment text field; 2) cross-join employees and sessions; (this gives a record-set with all the occasions someone could have attended); 3) left outer-join the result of (2) on the presence table, joining on both employee-id and session-id; in principle entering presence data should cause a new record to be created with the two foreign keys; 4) couple the result of (3) as a subform of a session form, with the subform coupled on session-id.
The result would thus be a form with information about the session; it has a subform with a list of employees and a 'present' field against each, and the user can run through the list, ticking off everyone who was present at that session. (The total number of employees is only around 30, so this is perfectly feasible for the user.)
All fine and dandy except for one thing - the record-set resulting from step (3) is non-updateable.
How do I get an updateable record-set? Or am I barking up the wrong tree completely, and need to tackle it differently?
--
Stephen Poley
Stephen Poley wrote: Any suggestions?
On Fri, 24 Feb 2006 17:37:57 +0100, Stephen Poley <sb******************@xs4all.nl> wrote:
I have the following situation: - a table of employees, keyed on employee-id; - a table of training sessions, keyed on session-id; - a requirement to log who was present at which session, plus optional extra textual information (e.g. "left early due to illness").
The solution I had in mind was: 1) create a presence table, keyed on employee-id and session-id, containing a 'present' yes/no field and a comment text field; 2) cross-join employees and sessions; (this gives a record-set with all the occasions someone could have attended); 3) left outer-join the result of (2) on the presence table, joining on both employee-id and session-id; in principle entering presence data should cause a new record to be created with the two foreign keys; 4) couple the result of (3) as a subform of a session form, with the subform coupled on session-id.
The result would thus be a form with information about the session; it has a subform with a list of employees and a 'present' field against each, and the user can run through the list, ticking off everyone who was present at that session. (The total number of employees is only around 30, so this is perfectly feasible for the user.)
All fine and dandy except for one thing - the record-set resulting from step (3) is non-updateable.
How do I get an updateable record-set? Or am I barking up the wrong tree completely, and need to tackle it differently?
-- Stephen Poley
Maybe you're tackling the wrong tree :-).
Use a form that has comboboxes for employee and training along with a
combobox for class that gets filled when the training ID is selected.
When the employee and class are selected the form makes a new record in
tblClassAttendance. So you need a table in addition to the ones Ed
suggested:
tblClassTraining
CTID Autonumber PK
ClassID Long FK
TngID Long FK
that shows the classes that fit under a given training ID. Note that
the same class may fall under multiple training ID's. This table can
also be filled using a form. So now you really need another table that
holds all the names of the classes. A possible schema:
tblEmployee
EmployeeID Autonumber PK
EmployeeLastName Text
....
tblClass
CID Autonumber PK
ClassName Text
ClassDate Date/Time
ClassLocation Text
....
tblTraining
TrainingID Autonumber PK
TrainingCategoryName Text
....
tblClassTraining
CTID Autonumber PK
ClassID Long FK
TrainingID Long FK
tblClassAttendance
CAID Autonumber PK
EmployeeID Long FK
TrainingID Long FK
WasPresent Y/N
Notes Text
So tblEmployee, tblClass and tblTraining are each filled in using a
form. After the classes and training categories are created, another
form associates classes with each training category and the results are
added to tblClassTraining. An enrollment form with three comboboxes
will place the chosen employee into a class chosen from classes that
fall under a chosen training category.
Many here can suggest SQL strings or other means for handling
attendance or other tasks once you have your schema nailed down.
Hopefully we'll be able to suggest a SQL string that is updateable.
James A. Fortune CD********@FortuneJames.com
On 27 Feb 2006 13:22:39 -0800, CD********@FortuneJames.com wrote: On Fri, 24 Feb 2006 17:37:57 +0100, Stephen Poley <sb******************@xs4all.nl> wrote:
>I have the following situation: >- a table of employees, keyed on employee-id; >- a table of training sessions, keyed on session-id; >- a requirement to log who was present at which session, plus optional >extra textual information (e.g. "left early due to illness"). > >The solution I had in mind was: >1) create a presence table, keyed on employee-id and session-id, >containing a 'present' yes/no field and a comment text field; >2) cross-join employees and sessions; (this gives a record-set with all >the occasions someone could have attended); >3) left outer-join the result of (2) on the presence table, joining on >both employee-id and session-id; in principle entering presence data >should cause a new record to be created with the two foreign keys; >4) couple the result of (3) as a subform of a session form, with the >subform coupled on session-id. > >The result would thus be a form with information about the session; it >has a subform with a list of employees and a 'present' field against >each, and the user can run through the list, ticking off everyone who >was present at that session. (The total number of employees is only >around 30, so this is perfectly feasible for the user.) > >All fine and dandy except for one thing - the record-set resulting from >step (3) is non-updateable. > >How do I get an updateable record-set? Or am I barking up the wrong tree >completely, and need to tackle it differently?
Maybe you're tackling the wrong tree :-).
Use a form that has comboboxes for employee and training along with a combobox for class that gets filled when the training ID is selected. When the employee and class are selected the form makes a new record in tblClassAttendance.
<snip>
OK, that would work, but if I understand it correctly, it isn't as user
friendly as one would like. To record that 20 employees attended a given
session, the user would need to:
- select the session in the combobox (the number of sessions is
sufficiently large to require scrolling)
- select the employee in the combobox (the number of employees is also
sufficiently large to require scrolling)
- tick the box
- select next record
.... and repeat that 20 times. (I think - if it's actually much simpler
than this, please correct me.)
I was hoping that the user could:
- select the session in a combobox once
- be presented with a list of employees in a subform, with a checkbox
against each (it would presumably be greyed out initially, as the
records don't yet exist)
- quickly tick off everyone who was present.
Is that possible? In a situation where the table with the checkboxes is
joined to a single table it is, and I was hoping that it also would be
possible if they were joined to a pair of cross-joined tables.
If all else fails I suppose I could just create a record for every
employee/session combination in VBA, but it's not a very nice solution.
--
Stephen Poley
Stephen Poley wrote: On 27 Feb 2006 13:22:39 -0800, CD********@FortuneJames.com wrote:
On Fri, 24 Feb 2006 17:37:57 +0100, Stephen Poley <sb******************@xs4all.nl> wrote:
>I have the following situation: >- a table of employees, keyed on employee-id; >- a table of training sessions, keyed on session-id; >- a requirement to log who was present at which session, plus optional >extra textual information (e.g. "left early due to illness"). > >The solution I had in mind was: >1) create a presence table, keyed on employee-id and session-id, >containing a 'present' yes/no field and a comment text field; >2) cross-join employees and sessions; (this gives a record-set with all >the occasions someone could have attended); >3) left outer-join the result of (2) on the presence table, joining on >both employee-id and session-id; in principle entering presence data >should cause a new record to be created with the two foreign keys; >4) couple the result of (3) as a subform of a session form, with the >subform coupled on session-id. > >The result would thus be a form with information about the session; it >has a subform with a list of employees and a 'present' field against >each, and the user can run through the list, ticking off everyone who >was present at that session. (The total number of employees is only >around 30, so this is perfectly feasible for the user.) > >All fine and dandy except for one thing - the record-set resulting from >step (3) is non-updateable. > >How do I get an updateable record-set? Or am I barking up the wrong tree >completely, and need to tackle it differently?
Maybe you're tackling the wrong tree :-).
Use a form that has comboboxes for employee and training along with a combobox for class that gets filled when the training ID is selected. When the employee and class are selected the form makes a new record in tblClassAttendance.
<snip>
OK, that would work, but if I understand it correctly, it isn't as user friendly as one would like. To record that 20 employees attended a given session, the user would need to:
- select the session in the combobox (the number of sessions is sufficiently large to require scrolling) - select the employee in the combobox (the number of employees is also sufficiently large to require scrolling) - tick the box - select next record
... and repeat that 20 times. (I think - if it's actually much simpler than this, please correct me.)
I was hoping that the user could: - select the session in a combobox once - be presented with a list of employees in a subform, with a checkbox against each (it would presumably be greyed out initially, as the records don't yet exist) - quickly tick off everyone who was present.
Is that possible? In a situation where the table with the checkboxes is joined to a single table it is, and I was hoping that it also would be possible if they were joined to a pair of cross-joined tables.
If all else fails I suppose I could just create a record for every employee/session combination in VBA, but it's not a very nice solution.
-- Stephen Poley
The way I see it, marking the attendance is a different situation than
enrollment. After the enrollment process is over I envisioned marking
the attendance using the entire list available from the enrollment
process in a subform, possibly using a datasheet view. Maybe add CID
from tblClass to tblClassAttendance as a foreign key also. Then the
SQL statement:
SELECT WasPresent, Notes FROM tblClassAttendance WHERE CID = 3;
should be updateable. Note that any inner joins with tblEmployee,
tblClass or tblTraining using the corresponding primary key should not
affect the editability of a query.
So the problem may become, "Can I do the enrollment for a class in one
fell swoop?" Perhaps a multiselect listbox can be used to select all
the employees that are to be enrolled in a given class. If so, you'll
still need to be able to add or delete employees later. You should
keep working out these ideas at the schema level until you are
satisfied that you will be able to get the data you need for your
reports. Your idea of a subform with employees is correct except that
the checkboxes will actually exist if the enrollment and attendance are
treated separately.
James A. Fortune CD********@FortuneJames.com
you could try something like this:
Select ty.* from (((Select fld1, fld2, ... From tbl1 Where...) t1 cross
join (select fld1, fld2, ... from tbl2 Where...) t2) tx Left Join
(select * from tbl3) t3 On tx.Id = t3.Id) ty
Rich
*** Sent via Developersdex http://www.developersdex.com *** This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: * ProteanThread * |
last post by:
but depends upon the clique:
...
|
by: rollasoc |
last post by:
Hi,
Doing a bit of system testing on a Windows 98 laptop. (.Net 1.1 app).
Did a bit of testing. Loaded a previously saved file. A gray box
appeared with the text and buttons all white...
|
by: David Peach |
last post by:
Hello, hope somebody here can help me... I have a query that lists
defects recorded in a user defined date range. That query is then used
as the source for a Cross Tab query that cross-tabs count...
|
by: Jeff Rodriguez |
last post by:
Here's what I want do:
Have a main daemon which starts up several threads in a Boss-Queue structure.
From those threads, I want them all to sit and watch a queue. Once an entry
goes into the...
|
by: Scott M. |
last post by:
How can I disable the cross-site scripting check for one particular page of
a site?
|
by: Pieter |
last post by:
Hi,
I'm having some weird problem using the BackGroundWorker in an Outlook
(2003) Add-In, with VB.NET 2005:
I'm using the BackGroundWorker to get the info of some mailitems, and after
each item...
|
by: Rob Woodworth |
last post by:
Hi,
I'm having serious problems getting my report to work. I need to
generate a timesheet report which will contain info for one employee between
certain dates (one week's worth of dates). I...
|
by: Simon |
last post by:
Hi All,
An experiment i'm doing requires requires a synchronous cross-domain
request, without using a proxy. I wondered if anyone had any ideas to
help me achieve this.
Below is what I have...
|
by: Bart Van der Donck |
last post by:
Hello,
I'm presenting my new library 'AJAX Cross Domain' - a javascript
extension that allows to perform cross-domain AJAX requests.
http://www.ajax-cross-domain.com/
Any comments or...
|
by: ampo |
last post by:
Hello.
Can anyone help with cross-domain problem?
I have HTML page from server1 that send xmlHTTPRequest to server2.
How can I do it?
Thanks.
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: lllomh |
last post by:
How does React native implement an English player?
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
| |