Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time/Date Question

Status
Not open for further replies.

andy570

Technical User
Jan 5, 2004
40
US
Hi all....is it possible to enter 2 expressions in a default value. For example in a memo field could I enter say =Now() followed by text? So that each time text was added the time that it was added would be displayed? or am i better off creating another field for Date/time?
 
The default value property only starts the field off with that value on the addition of a new record. Additional updates to the field after that does not. In answer to your questions yes you can cancatenate text onto the Date() function such as the following:

Code:
Date() & " - " & CurrentUser()

This would put the current date along with the CurrentUser login to the database thus identifying who was adding the information to the field.

To add new data to an already existing record and memofield data use the following code from behind a command button. Use the OnClick Event Procedure.

Code:
Me![memofield].Locked = False
Me![memofield].SetFocus
If Me![memofield] = " " Or Me![memofield] = "" Or IsNull(Me![memofield]) Then
    Me![memofield] = Date() & " - " & CurrentUser() 
Else
    Me![memofield] = Me![memofield] & vbCrLf & Date() & " - " & CurrentUser() 
End If
Me![memofield].SelLength = 0
Me![memofield].SelStart = Len(Me![memofield]) + 1

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top