Good afternoon beretta819,
I hope your day is going well. Try using the following format for your ExecuteSQL statement:
""; ""; $$username)
Hopefully this helps. Have a great day!
You could calculate a field to be equal to $$username, and use that as a field on the "left" or "local" side of a relationship. You'll need to leave it unstored, though.
The result in the userFK field is only a "?".
The "?" always means that there is a syntax error in your SQL statement. Bill has given you a fix for that.
Note that in these SQL statements you tend to hard code TO and field names. There are ways around that and make the SQL statement safe for any changes you will make to the schema in the future.
The way to do this using "strictly" FM ways:
Set $$Username = Get ( AccountName )
Go to a layout based on the USERS table.
Enter Find Mode
Set Field Username = $$Username
If ( Get ( FoundCount ) = 1)
Set Field USERS::userFK = $$Username
Show Custom Dialog: "The username " & $$Username & " is not in the Users table. Notify someone."
Go to Layout for users that don't exist or something like that.
This assumes that userFK is a global field.
The ExecuteSQL method is wonderfully handy and very powerful. You should add some error checking with either method (in the above, the example makes sure that the proper username does exist in the users table and warns the user when it doesn't.)
Perfect!! Thank you and God bless you.