Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Unable to set Default Value to Function in a table

Posted on 2009-02-09
4
Medium Priority
?
530 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
0
Comment
Question by:Karen Schaefer
  • 2
  • 2
4 Comments
 
LVL 14

Expert Comment

by:pteranodon72
ID: 23594862
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
0
 

Accepted Solution

by:
Karen Schaefer earned 0 total points
ID: 23595451
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
0
 
LVL 14

Expert Comment

by:pteranodon72
ID: 23601391
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
0
 

Author Comment

by:Karen Schaefer
ID: 23603782
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
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

580 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