0

I've seen a number of questions relating to this that are quite dated, I've tried to use the = Environ("Username") as the default for a field so that when a new record is created it automatically populates the userid field with the user along with another field with the date. Environ is an unsafe function and is blocked by sandbox. Is there an alternative to using Environ that can be used in this instance.

Thanks in advance Rob

  • `CreateObject("WScript.Network").UserName` – Andre May 22 '18 at 12:20
  • Thanks, I've added the above as a Public Function GetUserName () as string, GetUserName = CreateObject("WScript.Network").Username, End Function I've then added = GetUserName() to the default value of the field and it returns #Name? – Rob Jackson May 22 '18 at 12:38
  • You can't do this in table design, you must use a form. https://www.tek-tips.com/viewthread.cfm?qid=691128 -- https://social.msdn.microsoft.com/Forums/office/en-US/c6c9ada2-c3f4-4c6b-a2cf-710121281e7c/default-value-in-table-not-recognizing-custom-function?forum=accessdev – Andre May 22 '18 at 12:59

0 Answers0