D
Don
On a form there is a sub form with e-mail addresses. The default view
for the sub form is continuous form. The controls for the detail on
the sub form are a text box for the e-mail address, a check box to
indicate if that address is the primary address for the individual, and
then a tex box for comments. In the case where more than one detail is
displayed, is there a way to tell If there are more than one details
(rows), is there anyway of telling which detail (row) being modified?
For example, if the sub form is showing:
(e-mail address removed) ( ) work
address
(e-mail address removed) (check) home adress
(e-mail address removed) ( ) text only
e-mail
and the user clicked the check box for (e-mail address removed), if I
reference the control txtEmailAddress, which address will it return?
And why? Is there a way to reference the controls for the other
details?
The purpose of all this is to implement code to check how many primary
addresses there are for an employee when an addition or change is made.
If there are more than one, the user is forced to pick. If the change
would result in no primary, the user is prompted to pick another.
The algorithm for a change to the primary check box would be something
like this:
if cleared
check to see if there is an e-mail marked primary
if another primary
don't do anything else
else
warn user and leave checked
if set
check to see if there is another primary
if not
carry on
else
warn user there is another primary
make user chose one or the other as primary
I tried implementing this in the before change event of the check box,
but ran into a problem which I think is caused by changing one of the
other details. It seems like it that change caused the BeforeChange
event to be fired again. (Does a change to the underlying data cause
the change events to fire?)
Any suggestions on this?
Thanks!
Don
for the sub form is continuous form. The controls for the detail on
the sub form are a text box for the e-mail address, a check box to
indicate if that address is the primary address for the individual, and
then a tex box for comments. In the case where more than one detail is
displayed, is there a way to tell If there are more than one details
(rows), is there anyway of telling which detail (row) being modified?
For example, if the sub form is showing:
(e-mail address removed) ( ) work
address
(e-mail address removed) (check) home adress
(e-mail address removed) ( ) text only
and the user clicked the check box for (e-mail address removed), if I
reference the control txtEmailAddress, which address will it return?
And why? Is there a way to reference the controls for the other
details?
The purpose of all this is to implement code to check how many primary
addresses there are for an employee when an addition or change is made.
If there are more than one, the user is forced to pick. If the change
would result in no primary, the user is prompted to pick another.
The algorithm for a change to the primary check box would be something
like this:
if cleared
check to see if there is an e-mail marked primary
if another primary
don't do anything else
else
warn user and leave checked
if set
check to see if there is another primary
if not
carry on
else
warn user there is another primary
make user chose one or the other as primary
I tried implementing this in the before change event of the check box,
but ran into a problem which I think is caused by changing one of the
other details. It seems like it that change caused the BeforeChange
event to be fired again. (Does a change to the underlying data cause
the change events to fire?)
Any suggestions on this?
Thanks!
Don