Link to home
Start Free TrialLog in
Avatar of Karen Schaefer
Karen SchaeferFlag for United States of America

asked on

Unable to set Default Value to Function in a table

I keep getting error can't find function when I am setting the Default value to the name of the function in the filed of a table.  I tried settings, I made sure that the references are correctly set, and after researching the web - I am still unable to solve my problem - xref:

https://www.experts-exchange.com/questions/24126589/Using-Environ-Function-to-get-user-name-stops-working.html?anchorAnswerId=23593771#a23593771

It seems the problem is with the setting of the Default value and not the function itself, I am able to execute the function in the debug window and run - but when I try to place the default value to the function name it errors

Can anyone point me to a possible solution.
KFS.jpg
Avatar of pteranodon72
pteranodon72
Flag of United States of America image

I'd strongly recommend AGAINST using Environ -- the environmental variables are not necessarily present on any particular computer and the values are user-changeable. The sample function at
http://www.mvps.org/access/api/api0008.htm
gives a result you can trust.

-Do you have one or more public functions called Environ?

-Can you compile your code or do you have missing / broken references?

-Can you get the get:
=fOSUserName()
to work the default value property in a form? - You really shouldn't have data entry going on through tables but I understand the desire to have the default value come from a deeper level.

HTH,

pT
ASKER CERTIFIED SOLUTION
Avatar of Karen Schaefer
Karen Schaefer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Do you have any code modules in the database or code behind forms? If so, try going to the IDE (ctrl-G will open the immediate window) open a module or listed form's code and then see if you can
-Debug ->Compile (you may need to add a space or comment to a module to convince Access that the code needs compiling first

-Tools->References: If any reference is listed as missing, write down its name. Clear the checkbox.  Debug->Compile the code. If it compiles correctly, you don't need the reference. If it doesn't compile, you'll need to re-add the reference.

One bad reference can make all function references break, so my guess is that you've got one unrelated bad reference that is mucking up the Environ function.

HTH,

pT
Avatar of Karen Schaefer

ASKER

After doing the Detect & Repair and opening blank mdb - create a new table and test the Environ function in the default value - seems to have done the trick.  i then copied that field into my existing mdb/table/field -the problem seems to be solved.

thanks to all for their assistance.

karen