Record Creator or Update By

chrisb1981

Registered User.
Local time
Today, 12:31
Joined
Feb 7, 2007
Messages
13
I currently have the code
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.RecordCreator = "" Then
Me.RecordCreator = CurrentUser()
Me.CreatedDate = Now()
Else
Me.UpdateBy = CurrentUser()
Me.UpdateDate = Now()
End If
End Sub
which is not doing what I want it to. I know it is my knowledge of access which is letting me down. Basically if a record is created by John then the RecordCreator is set to John. If Phil goes in and amends the record it should put Phil's name in UpdateBy. So if the RecordCreator field is empty then it updates that field but if it is not empty UpdateBy field is updated. What it is doing is just putting the information into UpdateBy even when the RecordCreator is empty. I have tried putting in Null instead of "" but still the same happens.

Thanks for any help
 
When you say you tried putting null instead of "", do you mean you wrote:

If Me.RecordCreator = Null Then

If so, try the following:

If IsNull(Me.RecordCreator) Then
 
When you say you tried putting null instead of "", do you mean you wrote:

If Me.RecordCreator = Null Then

If so, try the following:

If IsNull(Me.RecordCreator) Then

Thanks addy that worked perfect. Like I said it's my lack of knowledge which is holding me back!!
 

Users who are viewing this thread

Back
Top Bottom