This topic is locked

update field that has a space

5/5/2008 9:33:40 AM
ASPRunnerPro General questions
T
Tim author

Hello,
I added this code to the "Before record added" event for an Add page:
dict("Noted By")=SESSION("UserID")
but it doesn't work, and it appears to be because of the space in the feild Noted By. I attempted to add [] to a variety of places, and tried "Noted_By", but couldn't get it to work. What would be the syntax to update this 2 worded feild?
Thanks,

Tim

Sergey Kornilov admin 5/5/2008

Tim,
you need to clarify "doesn't work" part.

Any error messages?

T
Tim author 5/5/2008

Sorry... no error. Just nothing in the database field Noted By.
But put this on hold for the moment... it seems I have bigger issues.
I added a new field to the table called CreatedBy and I am attempting to use that instead. I removed the "Noted By" field from my SQL statement. I added CreatedBy so the SQL statement, add the field to the Add page, then on the Add page in visual editor I linked the CreatedBy field to the ID field in another table. Now when I attempt to save i get the following error:
Conversion failed when converting the varchar value 'joe@fakeemail.com' to data type int.
It looks like it's grabing the wrong field (Email instead of ID) and from the wrong row! That email address is from the first record in the lookup table. When I first bring up the Add form it shows the ID correctly, so I'm not sure what's happening when I hit save.

Sergey Kornilov admin 5/5/2008

It appears that CreatedBy field is populated with email address which means you cannot link it to ID field which is numeric.
Without seeing your database and project file I can only make educated guesses.

T
Tim author 5/5/2008

Sorry to waste your time with this Sergey... I had put a trigger on that table a few weeks ago and had forgotten about it. It was messing up the insert. Everything works as expected now... no problem with dict("Noted By") = session("userid")
Thanks,

Tim