By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,327 Members | 1,936 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,327 IT Pros & Developers. It's quick & easy.

Add user and time stamp only to new records?

P: 11
Hi Guys - I've got a SQL Server backend and access front end.

I suspect this is pretty simple, but I want to add created by and when info to new records in my database, and modified by and when, when records are updated.

My question is, how do I get add the created details to new records ONLY. So for eg. if record is new...... then do etc.

Hope this makes sense.

Thanks - Chris
Aug 16 '07 #1
Share this Question
Share on Google+
5 Replies


P: 11
My short term solution is to check whether the created info fields are null. I would like something more robust though...
Aug 16 '07 #2

missinglinq
Expert 2.5K+
P: 3,532
You have inadvertently posted your question in the Articles section rather than in the Forum section of our site, so I have moved it across to the Forum for you.

Welcome to TheScripts!

Linq ;0)>
Aug 16 '07 #3

missinglinq
Expert 2.5K+
P: 3,532
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.   If Me.NewRecord Then
  3.      ' Place your here code for new records only
  4.   Else
  5.   'Place code here for existing records only
  6. End If
  7. End Sub
  8.  
Linq ;0)>
Aug 16 '07 #4

P: 11
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.   If Me.NewRecord Then
  3.    ' Place your code for new records here
  4.   End If
  5. End Sub
  6.  
Linq ;0)>

Brilliant!!!! Cheers for that.

Chris
Aug 16 '07 #5

missinglinq
Expert 2.5K+
P: 3,532
Glad we could help! I edited that a bit, by the way, in case there's something you only want to do for existing records! Note that anything in the Else clause will occur ever time you visit an existing record!
Aug 16 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.