D
doyle60
I have two date fields in a form. When one changes (DateSentLast) I
want the other one (DateSentOrig) to be filled in with the same date,
but only if it is previously null, otherwise to leave the field alone
with whatever date is presently in it:
This is the code I wrote and it works very well:
If IsNull(Me.DateSentOrigtxt) Then
Me.DateSentOrigtxt = Me.DateSentLast
End If
I put it in the OnCurrent event of the form because I want it only to
run when they actually move off the record. I do not want it in the
after update event of the date control because I'm afraid users will
be editing and not getting it just right at first. Since the nature
of this is that if the second date box is null, do this, any editing,
including mistyping would ruin it.
What is the problem? Well, the code runs even if a user does not have
permission to make a change on this form. It causes errors. How do I
get it only to run for those who have permission?
Moving it off the OnCurrent and putting it on the AfterUpdate would
solve this, I suppose, but as said, I do not want to do that.
Thanks,
Matt
want the other one (DateSentOrig) to be filled in with the same date,
but only if it is previously null, otherwise to leave the field alone
with whatever date is presently in it:
This is the code I wrote and it works very well:
If IsNull(Me.DateSentOrigtxt) Then
Me.DateSentOrigtxt = Me.DateSentLast
End If
I put it in the OnCurrent event of the form because I want it only to
run when they actually move off the record. I do not want it in the
after update event of the date control because I'm afraid users will
be editing and not getting it just right at first. Since the nature
of this is that if the second date box is null, do this, any editing,
including mistyping would ruin it.
What is the problem? Well, the code runs even if a user does not have
permission to make a change on this form. It causes errors. How do I
get it only to run for those who have permission?
Moving it off the OnCurrent and putting it on the AfterUpdate would
solve this, I suppose, but as said, I do not want to do that.
Thanks,
Matt