date function, created by and modified by function.

G

Guest

One more for today. What function is for creation date, created by,
modification date, and modified by? I looked in the help and I looked in the
functions. Is creation date date() or dateValue()
I can't guess for modifed by and created by.
thanks,
 
D

Douglas J. Steele

There are no such functions built into Access.

If you require those values on the records in your tables, you must add code
into the BeforeUpdate event of your form to set the values of the fields
accordingly.
 
J

John Vinson

One more for today. What function is for creation date, created by,
modification date, and modified by?

There are none, unless you put them into a table yourself. Access
doesn't care, and doesn't record, when or by whom a record was created
or modified.
I looked in the help and I looked in the
functions. Is creation date date() or dateValue()

Date() is today's date, whenever the function is called. You can put a
DateTime field into a Table and set its DefaultValue property to
Date() to automatically insert the date that the record was created
into the table. Unless you get tricky with database security, though,
you're not protected from someone opening the record and editing that
date to anything they want.
I can't guess for modifed by and created by.

Because they're not stored. You can get at the Access User if you've
implemented security and require a logon - using the CurrentUser()
function - or, with some VBA code, you can get the WindowsNT Logon ID.

John W. Vinson[MVP]
 
M

missinglinq via AccessMonster.com

Seeing your name, I have to ask if you're actually talking about an Access
app or have you mistakenly posted a question about a FilemakerPro app in the
wroing forum.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
J

John Vinson

Seeing your name, I have to ask if you're actually talking about an Access
app or have you mistakenly posted a question about a FilemakerPro app in the
wroing forum.

.... or, like many folks moving from one development to another,
perhaps needing to "unlearn" the "way things are always done" prior to
learning how they're done in the new environment. Been there, done
that, myself - all too many times!

John W. Vinson[MVP]
 
S

Smartin

FilemakerPro_Developer said:
One more for today. What function is for creation date, created by,
modification date, and modified by? I looked in the help and I looked in the
functions. Is creation date date() or dateValue()
I can't guess for modifed by and created by.
thanks,


I scrounged around in the FileSystemObject properties expecting to find
the answer to this, but failed. But I'm not very familiar with it either.

Maybe someone knows of an API call?
 
D

Douglas J. Steele

Smartin said:
I scrounged around in the FileSystemObject properties expecting to find
the answer to this, but failed. But I'm not very familiar with it either.

Maybe someone knows of an API call?

It depends what you're looking for.

The rest of us have been assuming that he (or she) is asking about creation
date, created by, etc. for rows in tables. If that's the case, then no,
there are no API calls that can help.

Your mention of FileSystemObject sounds as though you're assuming creation
date, created by, etc. for files. There's no way I'm aware of to determine
who created or modified the file using API calls, but you can certainly get
the dates. However, you can get those dates using FSO as well:

Dim objFSO As Object
Dim objFile As Object
Dim strFilePath As String

strFilePath = "C:\Folder\File.txt"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strFilePath)

Debug.Print strFilePath & " was created on " & _
objFile.DateCreated
Debug.Print strFilePath & " was last modified on " & _
objFile.DateLastModified
Debug.Print strFilePath & " was last accessed on " & _
objFile.DateLastAccessed


Randy Birch has a good example of how to get the dates using API calls (and
even how to change the dates) at
http://vbnet.mvps.org/code/fileapi/filedatetime.htm

(Obligatory warning: Randy's site is aimed at VB programmers. There are
significant differences between the controls available for forms in VB and
in Access. Because of that, many of Randy's examples won't port directly
into Access. Looking at this particular sample, though, I think it should
work in VB with no changes other than removing the references to .Text when
assigning values to the text boxes)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top