This topic is locked

After Update

11/12/2008 7:55:28 AM
ASPRunnerPro General questions
W
wisdom2009 author

Hello,
I need some help. I have users that go in and update the table uisng the form, usually they just make some basic changes, on the form there is a check box for approval, what i would like to do,it's once they check that box. automatically another field will have value as the date when the box was check.
Thanks

J
Jane 11/13/2008

Hi,
use Before record added/updated events on the Events tab for this purpose.

Here is a sample:

if dict("FieldName")<>"" and dict("FieldName")<>0 then

dict("FieldName2") = Now()

end if

W
wisdom2009 author 11/13/2008

Thank you Jane so much,
I have another request.
I would like name of user will be automatically populated on Name. Since they are logged in under their profile, per example, on the form, there will be fields that have Team, Date, Name and Comment, when the user try to add a comment, their name will be automatically populated. I tried to the code below but did not work for me
Table that hold users : tblUser

Table will information be insert to : tblcomment

Note : sAgentname Field on tblcomment

Name field on tblUser
Sub BeforeShowAdd(xt,templatefile)

str = "select name from tbluser where USERID='" & SESSION("USERID") ) & "'"
Set rsTemp = server.CreateObject("ADODB.Recordset")
rsTemp.open str, dbConnection

Session("sAgentname") = rsTemp("Name")
rsTemp.Close : set rsTemp = Nothing
End Sub ' BeforeShowAdd
Thanks Again

J
Jane 11/14/2008

Hi,
please see my changes in your code:

str = "select name from tbluser where USERID='" & Session("UserID") & "'"

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

rsTemp.open str, dbConnection
Session("sAgentname") = rsTemp("Name")
rsTemp.Close : set rsTemp = Nothing



where USERID is your actual field name where login name is stored.
Then set up Session("sAgentname") as default value for sAgentname field on the "Edit as" settingsdialog on the Visual Editor tab.