Locking fields once they have data

sush

Registered User.
Local time
Today, 08:18
Joined
Feb 8, 2000
Messages
29
Hello,

I am creating a database to log calls, i want the date and time to be entered as soon as they start to enter data. What i want to do is that once this information has been entered the date and time for this particular log can not be changed in any way, hence once the date and time have been automaticly entered, the user or the system should not be able to change the date and time.

Is this possible if so how?

Thanks All
 
There's several ways to do this.

You can simply add some VBA code to your form that fills in the date/timestamp for the user:
MyDTTime = Now()

It can all be behind the scenes, or you can display it on the form in a locked field.

We usually do Access as a front end to Oracle, so we have date/timestamps set up as database triggers. We'll use one date/timestamp for the initial entry, which is only updated when the record is created, then use another to show the last update. So you might want two, and you might want to trap the userid, also.
 
Set the default value of the control to =Now()
And set the controls properties to Allow edits No,Allow deletions No.
 
Thanks for the help,

I have used many ways to update the Time and date , using Onfocus of the Log notes update the Date /Time, but if i return to the log it changes the date/time again which it should but i dont want this to happen, i want the original date and time entered to stay as it is, but the date and time should be entered if i enter a new log.

does this help my explanation a little better?
 
Another option: In design view, set the default value for the date/timestamp field to =Now()

If you're using Oracle, the trigger syntax lets you specify the conditions for update the date/timestamp.

Now, when I suggested doing this in VBA, I should have said that you need to determine whether you are entering a new record or modifying an existing one. There's a bunch of ways of handling that, including having separate forms for entry & update. But I suppose you could just check to see if the date is null (in other words, you're in a new record) and then pop in the current date. If the date is not null, you're working on an existing record & don't want to change it.
 

Users who are viewing this thread

Back
Top Bottom