473,671 Members | 2,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add user and time stamp only to new records?

11 New Member
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
5 1961
chrisdavies
11 New Member
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
3,532 Recognized Expert Specialist
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
3,532 Recognized Expert Specialist
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
chrisdavies
11 New Member
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
3,532 Recognized Expert Specialist
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

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

Similar topics

10
4739
by: Yang Li Ke | last post by:
Hi guys, Im about to build a script which will log visitor time spent on my website. I got a few ideas about this, maybe checking visitors ip and storing that info in db with time in and then using session vars to check time out ... Anyone has any ideas about doing that kind of script? Thank you! -- Yang
5
6008
by: David C. Barber | last post by:
I'm trying to determine which user has locked a given record from VB6. I know I can use sp_lock and sp_who, and match up the data to determine which users have locked records in my database, however I haven't seen a way to match the specific user to the specific record. What am I missing here? Thanks! *David*
7
19611
by: Don | last post by:
Hi all, With regards to the following, how do I append the datetimestamp to the filenames in the form? The files are processed using the PHP script that follows below. Thanks in advance, Don Following running on client-side:
2
2510
by: vj | last post by:
I am not able to insert data , as i have one of the composite key as type of time stamp , which gets the current timestamp value. When two records are inserted with the same data in the composite key fields and expecting to hold a different value in the key field which holds the current timestamp, it does nt gets inserted , as two records gets inserted at the same timestamp. Is there any way to delay the insert , so that I can get the...
3
2710
by: luscus | last post by:
Thanks for all the responses on my first question. Unfortunately the answers I was given were too complicated for my small brain , and neophite condition to understand. So if you could talk down to me and write in easier terms I would be very gratefull to all you access wizards! Here is my problem. I have a table with maybe 10 fields, It is used to imput information taken over the phone to solve patient problems in our Spanish...
3
6414
by: fong.yang | last post by:
I have a textbox on my form label date/time. I also added a date/time column to my table as well. The table already contains records before the date/time column was added. How do I setup a date/time stamp to that textbox or column for any changes that is made to any records? I've added =Now() on the AfterUpdate properties of the text box, but it is only adding a stamp if new records are added not when there are just changes made. ...
6
13589
by: Mike Charney | last post by:
Is there a way to check a files date and time stamp from VBA in access. I have a need check a date stamp on a file that I am importing. Thanks in advance, Mike m charney at dunlap hospital dot org
7
4266
by: monomaniac21 | last post by:
hi i have a php site which allows users to save a cookie on their computer which stores their user id details and allows them to auto- login. i'm wondering whether this is safe, is it possible for a malicious user to find that cookie and change its value and therefore auto-login as someone else? and if so how can this be prevented?
4
1354
by: MLH | last post by:
Suppose you're using a query to update or append many records in a large table. And suppose one of those fields is a T/D stamp table and you're using Now() to write its value. It is conceivable that a large number of records could take a few milliseconds to write and that the time could change from 13:00:00 to 13:00:01 between the time the first record was modified and the time the last was modified. Now I've never seen that happen. But...
0
8476
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8820
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8670
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7433
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6223
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4224
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2810
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.