AnsweredAssumed Answered

Match Account Name to UserID

Question asked by beretta819 on Dec 18, 2015
Latest reply on Dec 20, 2015 by beretta819

Hello All...
I have two related tables, AUDIT and USER. On the AUDIT table I have a userFK field that I need to have populated with the USERID number, from the USER table, that matches the person who logged in.

 

I am using Get(AccountName) to identify the user and then I am setting a variable to that name ($$username). So I am trying to match $$username with USERNAME from the USER table and return and populate userFK with the ID #.

 

Someone told me SQL is the easiest way, (which I have no experience). I changed the userFK field to a stored calculation field, and got this far:

 

ExecuteSQL (

"SELECT UserID

FROM users

WHERE UserName = $$username"; "" ; "" )

 

The result in the userFK field is only a "?".

 

Any help or direction is greatly appreciated.

Outcomes