T
True.Kilted.Scot
Hi all.
I have a form, which is linked to a sub-form.
In the BeforeUpdate event of the form, I want to check the validity of
the values within several controls. So, my thought was to code it as
follows:
If Me.Dirty Then
.....
.....
End If
This way, only if the values on the form have changed, will I check the
values. However, this is causing a problem.
When the form is first displayed, all the fields are blank. I then
select a name from a drop-down list, and certain fields are populated.
However, if I move to the next record, I wouldn't expect any of the
validation code to be executed...but it is.
I guess that since the new values displayed are not the same as the old
values, the "Dirty" property is set to TRUE for the form and so the
BeforeUpdate code is triggered.
My question: How can prevent this happening? I can place an "If
Me.NewRecord = True Then", so that the code is only triggered if a new
record is created. However, the user can also modify an existing
record, and so far, I cannot get the Me.Dirty to work, or figure out an
alternative.
Any and all suggestions are, as always, appreciated.
Rgds
Duncs
I have a form, which is linked to a sub-form.
In the BeforeUpdate event of the form, I want to check the validity of
the values within several controls. So, my thought was to code it as
follows:
If Me.Dirty Then
.....
.....
End If
This way, only if the values on the form have changed, will I check the
values. However, this is causing a problem.
When the form is first displayed, all the fields are blank. I then
select a name from a drop-down list, and certain fields are populated.
However, if I move to the next record, I wouldn't expect any of the
validation code to be executed...but it is.
I guess that since the new values displayed are not the same as the old
values, the "Dirty" property is set to TRUE for the form and so the
BeforeUpdate code is triggered.
My question: How can prevent this happening? I can place an "If
Me.NewRecord = True Then", so that the code is only triggered if a new
record is created. However, the user can also modify an existing
record, and so far, I cannot get the Me.Dirty to work, or figure out an
alternative.
Any and all suggestions are, as always, appreciated.
Rgds
Duncs