Unable to set Default Value to Function in a table

Posted on 2009-02-09
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:

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.
Question by:Karen Schaefer
    LVL 14

    Expert Comment

    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
    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:
    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.



    Accepted Solution

    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?

    LVL 14

    Expert Comment

    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.



    Author Comment

    by:Karen Schaefer
    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.


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
    In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
    In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now