I'm trying to block access to certain users.

P

Patrick

HI!!!

I need to prevent a user from entering data on a record
being used by another user.( about the same time)

I've already started the code and things are moving, but
very slowly.

The only way I have found to detect if a user is changing
data on a form is with the DIRTY event. I can tell, with
the code I've writen, if someone is attempting to change
data.
My problem is, when i detect that a user is trying to
change data on a form that he should'nt be, I would like
to cancel the update,using Me.Undo but its not working!
ANy one knows why? or even better, a better way of doing
things.

thanks in advance for any help you can provide!
PAt.
Here is the code: in the event DIRTY.

If f = False Then
'check userName for this purticular ID.value.
'if they match allow editing. Else Tell user That he's
'not allow because another user is presently working on
it.

currentUser = fOSUserName' gets the user name
CurId = ID.Value

rep = DLookup("UserName", "TrackingRecords", "RecordNbr='"
& CurId & "'")

cpt = StrComp(currentUser, rep)

If cpt = 0 Then
' allow edit
Else
MsgBox "Canot be edited at this time."
Me.Undo

End If
 

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