Wow, thanks for the response; yeah, know about the lack of search capability,
but this is more like a diary which people enther there information to the
bottom of the field; brilliant people but people who can't seem to remember
to type in the date.
My suggested table would automatically fill in the date AND let them enter
their diary. You can display it on a Continuous Form so you can see past
entries easily.
In my ideal world the user will enter a shortcut (ctrl y would be fine) and
wherever the curser is, the date (and username, i didn't mention that in the
first message) will be inserted. Hopefully they will insert it at the left
of a blank line and only use it once, but that will be there problem.
Would love to see what this looks like in VBA, its frustrated me.
If you insist. Put a Command Button cmdDiary on the form with a Caption of
"Diar&y"
This will display Diary with the y underlined, and typing Alt-Y on the
keyboard will click the button. In its code put
Private Sub cmdDiary_Click()
Dim Username as String
Username = fOSUserName()
Me!txtMemofield.SetFocus
Me!txtMemofield = Me!txtMemofield & vbCrLf & Date & " " & Username
Me!txtMemofield.SelStart = Len(Me!txtMemofield)
End Sub
'******************** Code Start **************************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If ( lngX > 0 ) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
'******************** Code End **************************
The fOSUserName code is from
http://mvps.org/access/api/api0008.htm (and there
are tons more useful code on that site).