change subform based on form selection (1 Viewer)

P

peterschott

Guest
Greetings! This forum has been most helpful to a rusty Access user.

I'm creating a student group score entry form, having problems with creating the form I want. Say for example we have the following:
1. Three groups: A,B, and C.
2. Group A has 5 students, Group B has 3, and Group C has 20.

I want a form where I can select group A, and a list of the students will populate and enable me to enter scores for all of them on the same page. This will save time not having to re-enter the information for so many students. If anyone has a clue of what I'm talking about or is willing to lend me aid, I would appreciate it.

Cheers.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:02
Joined
Jul 9, 2003
Messages
16,282
As I understand your question you have one table of students, of whom there can be at least three groups A, B and C..

Two methods immediately spring to mind,

1) Change the record source of your subform, I prefer this method for a large database as it keeps all of the code within one form.

2) have the subform based on a query, and modify the query. I think this method would be easiest to implement .

First of all create a query that returns all of the records.

Add a combo box to your main form that just returns the name of the group you want the query to list.

Link this combo box to your query, this combo box should provide the criteria for the "group" column of your query.

Once you have got the query correctly returning the right group members, base your subform on this query, and then add the subform to the main form.

finally you will need to modify the combo box so that the after update event refreshes the subform.
 
P

peterschott

Guest
thank you and clarification

Thanks, I will give that a try. I should clarify, there are three tables:
1. Group listing (says that Group A is about Fly Fishing, taught by Jon Reel, B is about TV commercials taught by Mr. Nielsen, etc.)
2. Group Membership - Student Betty Brown is a member of Group A and B
3. Group Scores - Stores the scores for the group and the date of the group.

I set it up this way for several reasons:

1. If groups need to be added or changed, makes it easier.
2. Easier to add or change group membership.

In the meantime I will be trying the recommendation you had. I was going along those lines but not quite foolish enough to brave through it all. (Yes, I am rusty with access).

If the above information changes your recommendation please let me know. If not, then - woo hoo!! - I'll have it and let you know the results.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:02
Joined
Jul 9, 2003
Messages
16,282
Combo box on form to control the criteria of a query.

I have made an example with a program called "wink", I have done this mainly because I need to practice making examples with this product.

The attached example shows how to use a combo box on a form to control the criteria of a query. It should be a simple step to turn this query into a subform.

I have had to "Hack" the example about, to get it to meet the file size limit before I could attach it. So it's not a brilliant example.

When I get my new website Up and running, I will place my best examples there.
 

Attachments

  • ModifyQueryResultsByComboOnForm.zip
    386.2 KB · Views: 1,322

Users who are viewing this thread

Top Bottom