This topic is locked

Adding the logged in user's name automatically wjen he adds a reco

12/20/2006 1:06:25 AM
ASPRunnerPro General questions
orit author

I have a "Users" table that includes the fields: "user_name", "password" and "display_name". for the login, I use the "use_name" as the Username field and the "password" as the Password field. I have another table "Status" which is the main table of the application in which I have the fields: "status_id, "status_date", "status_information" and "status_owner".

How can I get the logged in user's "display_name" field from the "Users" table get into the "status_owner" field in the "Status" table when the logged in user adds a record?
Thanks

J
Jane 12/20/2006

Hi,
you can do it using events on the Events tab.

Here is a sample code:

Sub ListOnLoad()

str = "select display_name from Users where user_name='" & Session("UserID") & "'"

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection

Session("display_name") = rsTemp("display_name")

End Sub



Then use Session("display_name") as default value on the "Edit as" settings dialog on the Visual Editor tab.

orit author 12/20/2006

Perfect, Thanks a lot!