Subform Event

  • Thread starter Thread starter Chaplain Doug
  • Start date Start date
C

Chaplain Doug

I have a subform that is linked to my main form. Thus,
when I move from record to record on the main form, the
subform displays different data. What event is triggered
on the subform when I move from record to record in the
main form (and the subform is updated)? I ask becuase
there are some things I need to reset on the subform when
this event occurs. Thanks.
 
I have a subform that is linked to my main form. Thus,
when I move from record to record on the main form, the
subform displays different data. What event is triggered
on the subform when I move from record to record in the
main form (and the subform is updated)? I ask becuase
there are some things I need to reset on the subform when
this event occurs. Thanks.

The OnCurrent event of the *main* form would be most appropriate, I
think; the OnCurrent event of the subform will fire too, but that may
fire too often (i.e. as you navigate from record to record on the
subform).
 
Good to hear from you again John! By the way, I do not
have a unit on Mark 14-15 in our course, but would be
happy to provide other material on that section of the
Bible. Another question:

By the way I am de-spreadhseeting my DB as you so
graciously admonished me to do. I almost free!

In the aforementioned subform I include two fields:
LessonNum and LessonTitle. I want to increment the
LessonNum field whenever a record is added and decrement
or renumber the fields when a record is deleted (for
instance if there are seven records and the middle one
(LessonNum 4) is deleted then all the records thereafter
are automatically decremented by one. Thanks for the
help.
 
Good to hear from you again John! By the way, I do not
have a unit on Mark 14-15 in our course, but would be
happy to provide other material on that section of the
Bible. Another question:

We should take this off-group if you'ld be so kind - my email is
jvinson said:
By the way I am de-spreadhseeting my DB as you so
graciously admonished me to do. I almost free!

Good to be able to lead you in the right direction!
In the aforementioned subform I include two fields:
LessonNum and LessonTitle. I want to increment the
LessonNum field whenever a record is added and decrement
or renumber the fields when a record is deleted (for
instance if there are seven records and the middle one
(LessonNum 4) is deleted then all the records thereafter
are automatically decremented by one. Thanks for the
help.

The Subform should be based on the lesson *assignment* table - you
should have a separate Lesson table, with its own form, and should NOT
store the lessontitle in the "many to many" lesson assignment table,
just the unique LessonID.

To renumber all your lessons in the lesson form will be a LOT of work,
especially if this sequential number is the Primary Key or part of it.
It can be done, but it's going to be a lot easier if that number (and
the LessonTitls) exist ONLY in the Lessons table. Even at that it will
require an Update query and some VBA code. Could you post the names
and fields in your current set of tables so I can see my way to
helping with the code (and possibly some table restructuring)?
 
John:

Here are the tables I built based on your advice to de-
spreadsheet:

Students:
StudentID (Primary key linked to Grades table)
LastName
FirstName
Middle
DOB
Address
City
State
PostalCode
Inmate (These are booleans indicating position)
Officer
Staff
Other
Comments (Memo)

Units:
UnitID (Primary key linked to Lessons table)
UnitNo (Where unit appears in curriculum)
UnitTitle
NumLessons (Integer containing #lesson in unit.
Programmatically updated when lessons are defined for the
unit)

Lessons:
LessonID (Primary key)
UnitID (Linked to Units table)
LessonTitle

Grades:
GradeID (Primary key)
StudentID (linked to Students table)
UnitID (linked to Units table)
LessonID (linked to lessons table)
Grade
GDate (Date grade entered)
 
Lessons:
LessonID (Primary key)
UnitID (Linked to Units table)
LessonTitle

Grades:
GradeID (Primary key)
StudentID (linked to Students table)
UnitID (linked to Units table)
LessonID (linked to lessons table)
Grade
GDate (Date grade entered)

If LessonID isn't one already, I'd suggest making it an Autonumber
primary key (and using a Long Integer LessonID field in Grades as a
link).

Add a LessonNo field, integer would be fine, to Lessons to provide the
1 to 7 numbering within each Unit. (Autonumber clearly won't do for
this as the numbers won't repeat with different units - and you want
to have Unit 1, Lesson 1 and Unit 2, Lesson 1).

If you have a data entry form for Units, with a continuous subform for
Lessons, it would be easy enough to just manually renumber the
LessonNo fields (there'll only be seven or thereabouts on screen); but
if you wish I'll throw together some VBA code to renumber them.
Somewhere I have an old recipe application with code like that for
StepNumber to number the steps of a recipe - with two little arrow
up/arrow down buttons to renumber steps.
 
I found an adequate way to accomplish the numbering
without worrying about automatically
incrementing/decrementing, so my original question
is "never mind." However, I am glad I went through the
quantum leap to relational design at your behest. I think
I understand a little about it now. (Of course I might be
like Ernie who worked at the grease bay next to me on the
assembly line in 1974 when he said, "I know calculus . . .
Its just calculatin!)
 
Back
Top