We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Unable to set Default Value to Function in a table

Karen Schaefer
on
Medium Priority
539 Views
Last Modified: 2013-11-27
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:

http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_24126589.html#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
Comment
Watch Question

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
BI ANALYST
Commented:
No it doesn't allow me to input any type of function reference in the default value.  I tried using the FOUserName() function - still get the same error -

I also did a detect and repair on my MS Office Suite - still getting the same issue.  I just want a way to track who the current user is and use that as the default.  I have used this in the past and I know it works on other computers - due to the fact I have not rec'd any complaints that it is not working on other's pc.

Got any other ideas?

Karen

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
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
Karen SchaeferBI ANALYST

Author

Commented:
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
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.