How to have code run only for those with permissions

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
 
D

doyle60

Thanks.

That works fine enough.

But it does run when they dip into the subform (when it didn't
before), which I don't like.

But I'll take it.

No reason to get more tedious about it. Thanks,

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top