JackFlash
07-10-2001, 03:31 AM
I have designed a relatively complex database to store customer information on.. one section is a notes section. I would like to find a way that each time a member of our staff logs into the individual customer record:- an automatic note is made of their name(undeleteable)in the notes section, and an an option for the member of staff to make a note of why they accessed it i.e.
"JACKFLASH07/08/2001" - Automatically input (and undeletable)
Then an option to input a comment (also undeletable (depending upon user restrictions).
i.e.
"JACKFLASH07/08/2001 - Spoke to customer about order:she is to call back"
I have spent so much time trying to do this, I would much appreciate ANY help at all.
Thanks.
[This message has been edited by JackFlash (edited 07-10-2001).]
Atomic Shrimp
07-10-2001, 05:10 AM
As always in this kind of situation, I'd advocate storing the event data as multiple entries per customer in a separate table which would have CustID as a foreign key to your main customers table.
Don't store multiple values in the same field, it will just make for headaches later, so you might want to structure your events table like this:
CustID, Foreign key to CustID in Customers table
EventDate, Date/time - default value = Now()
StaffID, foreign key to table containing details/names of your staff members.
EventText, text field to describe what happened.
Then you can just append a record to the table each time an 'event' happens, you can show the events for the selected customer in a subform and set the AllowDeletions property according to the user's access priveleges.
Fornatian
07-10-2001, 05:17 AM
I would suggest adding another field to the table your notes is kept in called NoteBy. This will hold the personid id and date as you requested.
To my mind you can't have one part of field enabled/unlocked and another part disabled/locked. That is why you need two fields.
To input the ID of the user, you can access the netware login by adding this module and calling it from your code:
Declare Function wu_GetUserName Lib "advapi32" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Function NetworkUserName () As String
Dim lngStringLength As Long
Dim sString As String * 255
lngStringLength = Len(sString)
sString = String$(lngStringLength, 0)
If wu_GetUserName(sString, lngStringLength) Then
NetworkUserName = Left$(sString, lngStringLength)
Else
NetworkUserName = "Unknown"
End If
End Function
The way to call it is to say:
Me.NoteBy = NetworkUserName & " " & Date()
This way you can lock the Noteby field and set it when the user views the record. You have to decide if you want the user to have to enter a note every time they view the record - depends on how your db is designed - if you give the user the ability to scroll records you don't want them to have to enter 'scrolled through' for each records except the desired - if you get my drift.
Ian
JackFlash
07-11-2001, 12:09 AM
thanks mike, thanks al... pointed me in the right direction. ;o)