Ask Experts Questions for FREE Help !
Ask
    gwallace1's Avatar
    gwallace1 Posts: 25, Reputation: 1
    New Member
     
    #1

    Jan 1, 2009, 12:46 AM
    Combox populated by current recordset / attendance
    I have a main form that is for entering data for an Event. Included in the form are two separate subforms. One is for Employee attendance and is a continuous form with a combobox that is populated by a query to the employee table. The second subform is for recording scores for the event. It is also a continuous form with a combobox that currently is populated exactly as the combobox for the attendance subform. Both subforms are linked to the main form by the EventID.

    What I want to do is have the combobox in the scoring subform query only the employees that were entered as attending the Event that is being entered.

    The tables are as follows:

    Event
    --------
    EventID (pk)

    Employees
    ------------
    EmployeeID (pk)

    EventAttendance jx table
    -----------
    EventID
    EmployeeID

    EventScores
    EventScoresID (pk)
    EventID(fk)

    I do not know how to query the current recordset on the form. Thanks for your time.
    Happy New Year!
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #2

    Jan 1, 2009, 06:38 AM

    This is done through a subquery, but I think you have a design problem. If I'm following you, Each employee gets scored for an event. If so, then then the event score is an attribute of the combination of employee and event, NOT an attribute of the event. So, in fact, the even score should be a field in the junction table, not a separate table. So your EventAttendance table would look like this:

    EventAttendanceID (PK Autonumber)
    EventID (FK)
    EmployeeID (FK)
    Score

    So you don't need the second table or subform.
    gwallace1's Avatar
    gwallace1 Posts: 25, Reputation: 1
    New Member
     
    #3

    Jan 1, 2009, 01:50 PM

    Sorry I was not completely clear... I do have an employee ID in the EventScores tbl. I had typed a whole description of my design to explain it to you and in explaining it I see what you are saying and fixex it. Thanks for the help... I actually have six tables, three are scored individually for the employees that attend, three are not. By using what you pointed out, I eliminated the second subform in the three that are scored as I generate only a score for the employee that attended. The other three I only record attendance.
    For future reference... How is the subquery to populate the combobox designed, if one finds an application for it?
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #4

    Jan 1, 2009, 05:40 PM

    A subquery uses an IN clause as criteria with a SQL statement that returns one column.

    For example, if you wanted to show only employees registered for an event you would use something like this:

    IN(SELECT DISTINCT EmployeeID FROM tblEventAttendance WHERE EventID = Forms!formname!txtEventID)

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Is Earth the only populated planet? [ 127 Answers ]

Has God created beings on other planets besides Earth? And if so, are there also sinners in those worlds?

Need to know maximum/minimum air unit for sporadiclly populated building [ 16 Answers ]

How does one figure the size needed for an air conditioner in a church keeping in mind that the church is full of people at once for a couple of hours and then empty for several hours later considering the heat emisson per person while church is full and then offsetting the times when the church...

Probability of getting a warning due to non attendance [ 3 Answers ]

I work 250 days / year my average off sick is 5 days /year (mean Imay be off sick 5 days/year) if I am off sick 2 days within 13 weeks, I willget a warning what's the probability of having a warning? any help will be appreciated

Church attendance [ 5 Answers ]

I know when it comes to issues between myself and the Lord, it is only up to myself to make everything right. However, I am guilty of hardly attending mass on a regular basis. I managed to attend for Easter last year, but cannot find myself to attend on a regular basis. By the end of the work...


View more questions Search