Using subform to add new records

Joined
Jun 30, 2005
Messages
1
Reaction score
0
This is probably bread and butter stuff but I can't work out how to do it!

I have data stored in 2 tables.
One is a list of groups and has fields GroupNumber, LeaderID, DeputyID
The other table holds the data for where these groups are at any time. It has fields GroupNumber, Time, Activity, Location.

In the first table GroupNumber is the primary key, in the second GroupNumber and Time are a composite key.

What I want to be able to do is to create a form that has GroupNumber at the top and a subform on it that lists only Time, activity and location. I created a subform as a datasheet that takes data from the activity table and a main form that takes GroupNumber from the group table when i link these using GroupNumber in the master and child fields and try and cycle through all the group numbers I get records for each and everyinstance of the GroupNumber and Time pair.

I've just re-read what I've written and it doesn't make sense even to me so here's an example of what I'm trying to achieve. I'm not 100% sure of the right terms to use to explain it to you :(

I have data like:

Code:
Group#    LeaderID    DeputyID
   1         1           2
   2         3           4

Group#   Time      Activity         Location
  1      0800   registration       room 22
  1      0900   coffee             main hall
  2      0800   registration       room 19
  2      1015   lecture            main hall

I want my form to look a bit like this:

Code:
    Group#  1

Time    Activity          Location
0800   registration       room 22
0900   coffee             main hall

where the time, activity and location will allow additions that automatically fill in group# using the one at the top of the page. Ideally I should be able to type any group number in to the top box and go direct to that group's list and make edits and additions to the subform rather than having to cycle through as there will be ~100 groups.

I can do it using an unbound box as group# and rerunning a query using the onUpdateEvent to filter only the data I want to see but that only allows edits of the existing records and doesn't allow me additions as the group# remains 0 (the default value for all new records i try and add. Besides it's a bit of a crude hack. There must be a proper way to do this.

That should be easy shouldn't it??
Why am I totally unable to make it work!

All help gratefully received.
 
Back
Top