only one person in a field

megatronixs

Registered User.
Local time
Today, 01:17
Joined
Aug 17, 2012
Messages
719
Hi all,
I have a form where one person wil insert a new record and click on a button that will display his login name and date she/he inserted the new record. A second person will later check if everything was entered correctly and this person will also press a button that will insert his login name and date in a field.
The thing is that the same person can't do the quality check and insert the new record. So if in the field "PersonPassQA" is filled in and the person will do the same in "PersonQA", she/he should get a warning and the field should stay empty.

This is the code I use to pass the PersonPassQA:
Code:
Private Sub Command24_Click()
'Date pass to QA and person passing to QA
Me.[DatePassedQA] = Date
Me.[PersonPassQA] = Environ("Username")
Me.Refresh
End Sub

and this for PersonQA:
Code:
Private Sub Command25_Click()
'Date QA done and person  who did QA
Me.[DatedQaDone] = Date
Me.[PersonQA] = Environ("Username")
Me.Refresh
End Sub

Any help getting this working is really appriciated ;-)

Greetings.
 
Hello, something like this ? :

Code:
Private Sub Command24_Click() 
'Date pass to QA and person passing to QA 
If Me.[PersonQA]=Environ("UserName") then
           MsgBox ("Warning !")
             ' You can add what you want as new actions
     Else
           Me.[DatePassedQA] = Date 
           Me.[PersonPassQA] = Environ("Username") 
           Me.Refresh 
End If
End Sub
 
Hi,
Thanks for the code.
Little question, how can I cancel the imput into the field if both logins are the same?
My knowelegde of access is still basic :-(

Greetings.
 
Hi,
Actually it does not insert nothing if the person is the same ;-)
I have it working now ;-)

Thanks a lot for your help.
 
Hi Richar3dner,

Per mistake I added the code to the wrong button and got confused that the field still was filled in. After better locking in the code I saw the mistake and corrected it. Now when the field of the one passing to QA is filled in with is login name, he can´t do QA himself. If she/him presses the button a warning message appears and nothing is filled in the field.

Greetings.
 

Users who are viewing this thread

Back
Top Bottom