P
Peter R. Fletcher
In a database used for tracking adult education classes, I have a form
for entering Class information, normally operating in "Continuous
Forms" mode, with a listbox which allows the Course to be specified
(Course information being kept in a separate Table with a 1:Many
relationship with the Class Table). I am trying to ensure that the
Course is never Null (to avoid problems if the user puts in some
information, does not specify the Course, ands tries to close the
Form), and I have run into the following odd behaviour: If a default
value is specified for the ListBox control and the value of that
control is the first thing to be changed on a New record (by
displaying and clicking on the displayed information corresponding to
the new value), a new instance of the continuous form (a fresh "New
Record") is displayed below the one being used and the value of the
ListBox control for the record being added is reset to the control's
specified default value. Once the record has been Dirtied (either by
changing another control first, or simply by making the "ignored"
entry in the ListBox), everything works as it should. This is not just
a function of the Continuous Forms mode, because it also happens in
"Single Form" mode, though you don't see the new "New Record" appear,
of course.
This is a very complex form with a lot of code behind it, but as far
as I can see, no code is being executed (or at least, none of mine!)
between the new value of the ListBox being selected and the default
value being "magically" restored.
Is this what should happen in this situation?
Is there any fix for it? The Course is the first thing that the user
should logically set for a new Class, so it would not be particularly
helpful to tell them to do something else first.
I am temporarily setting the value of the control for a New Record in
the Current event, but this introduces other problems.
for entering Class information, normally operating in "Continuous
Forms" mode, with a listbox which allows the Course to be specified
(Course information being kept in a separate Table with a 1:Many
relationship with the Class Table). I am trying to ensure that the
Course is never Null (to avoid problems if the user puts in some
information, does not specify the Course, ands tries to close the
Form), and I have run into the following odd behaviour: If a default
value is specified for the ListBox control and the value of that
control is the first thing to be changed on a New record (by
displaying and clicking on the displayed information corresponding to
the new value), a new instance of the continuous form (a fresh "New
Record") is displayed below the one being used and the value of the
ListBox control for the record being added is reset to the control's
specified default value. Once the record has been Dirtied (either by
changing another control first, or simply by making the "ignored"
entry in the ListBox), everything works as it should. This is not just
a function of the Continuous Forms mode, because it also happens in
"Single Form" mode, though you don't see the new "New Record" appear,
of course.
This is a very complex form with a lot of code behind it, but as far
as I can see, no code is being executed (or at least, none of mine!)
between the new value of the ListBox being selected and the default
value being "magically" restored.
Is this what should happen in this situation?
Is there any fix for it? The Course is the first thing that the user
should logically set for a new Class, so it would not be particularly
helpful to tell them to do something else first.
I am temporarily setting the value of the control for a New Record in
the Current event, but this introduces other problems.