This topic is locked
[SOLVED]

 Temporarily Overriding Default Value on Add Page

6/2/2012 1:27:38 PM
ASPRunnerPro General questions
M
McGowan author

I'm trying to figure out a way to allow temporary overriding of a default value on an Add page.
On the Add page I have a field that has been set 'Edit As' a 'Lookup table' and a custom 'Display field' showing the "LastName, FirstName" of a user based on 'MemberID' with the default value set to "Session("MemberID")".
In the 'Before Process' event for the Add page, I have:

str = "Select * from Members where Members.Login='" & Session("UserID") & "'"

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

rstmp.open str,dbConnection

Session("MemberID") = rstmp("MemberID")

rstmp.close

set rstmp=nothing


It works fine and whenever a new record is added, the drop-down 'OppMgrID' is pre-populated with the "LastName, FirstName" of the person logged in. - Good to go.
The problem is that if the need arises to override what is in the Default, say when someone is adding records on behalf of someone else, what is selected from the drop-down isn't what gets recorded in the database, instead the Default is recorded. Yes, the user can then go in and Edit the record and change it, where it does work, but this is an added and unnecessary step.
Can what I'm trying to achieve be done and how? If someone out there knows how to do this, I would greatly appreciate the help.
Thanks.

Sergey Kornilov admin 6/2/2012

Just in case make sure you are not using advanced security mode 'Users can see and edit their own data only' mode. With this option turned on OwnerID field will be overwritten with current logged user ID.

M
McGowan author 6/3/2012

Sergey,
Thanks, that resolved it. I must have inadvertently set that security for this table and not realized it. Since that field is not normally associated with an OwnerID field, it didn't enter my mind to look there. You've now educated me on this. Thank you!