By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,558 Members | 1,607 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,558 IT Pros & Developers. It's quick & easy.

Why no user-defined functions as default values? (error 3388)

P: n/a
I have a cool function that I want to use as a default value for a column in
my table. But I can't because apparently Access doesn't allow user defined
functions in expressions for default values. It's very annoying. Is there
any way around it?

What I need is something like AutoNumber, *except* I want the values to be
unique across six different tables. Any ideas?
Unknown function <name> in validation expression or default value on <name>.
(Error 3388)
The function you are referencing is either unknown (because the name is
invalid or misspelled) or is a type of function not allowed by the
ValidationRule or DefaultValue property. Among the types of functions not
allowed are user-defined, SQL aggregate functions.
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Sat, 10 Jan 2004 04:56:02 GMT, "Ed Havelaar"
<e.********@it.canterbury.ac.nz> wrote:

Read the help file on DefaultValue:
If the property setting is an expression, it can't contain
user-defined functions...

So you're left with putting your function call with each control that
has this field as its ControlSource.

-Tom.

I have a cool function that I want to use as a default value for a column in
my table. But I can't because apparently Access doesn't allow user defined
functions in expressions for default values. It's very annoying. Is there
any way around it?

What I need is something like AutoNumber, *except* I want the values to be
unique across six different tables. Any ideas?
Unknown function <name> in validation expression or default value on <name>.
(Error 3388)
The function you are referencing is either unknown (because the name is
invalid or misspelled) or is a type of function not allowed by the
ValidationRule or DefaultValue property. Among the types of functions not
allowed are user-defined, SQL aggregate functions.


Nov 12 '05 #2

P: n/a
TC
Why?

There is Access, and there is Jet. Access is the forms, reports, macros &
modules. The actual tables (and queries) are stored in Jet - a completely
seperate product. The default values are actioned by Jet - not Access. So,
if a default value used an Access user-defined function, Jet would have to
call back in to Access, to get the value of that function. Then, what would
happen if a Visual Basic program opened that Jet database, and created a
record in that table? Should Jet start a copy of Access, so that it could
call the function to get the correct default value? What if that copy of
Access ran an autoexec macro, and started the Access application (eg. opened
an Access form)? What would the poor VB user, make of all that?

So if you look at how it is architectured internaly, yo can see that it does
not make sense to expect a table default value to be able to use an Access
function. Access is just one of many possible front-ends to a Jet database.
You can't expect Jet to store any permanent "thing" (like a default value)
that requires for a >specific front-end program< to be running at that time.

HTH,
TC
"Ed Havelaar" <e.********@it.canterbury.ac.nz> wrote in message
news:8a******************************@news.teranew s.com...
I have a cool function that I want to use as a default value for a column in my table. But I can't because apparently Access doesn't allow user defined functions in expressions for default values. It's very annoying. Is there any way around it?

What I need is something like AutoNumber, *except* I want the values to be
unique across six different tables. Any ideas?
Unknown function <name> in validation expression or default value on <name>. (Error 3388)
The function you are referencing is either unknown (because the name is
invalid or misspelled) or is a type of function not allowed by the
ValidationRule or DefaultValue property. Among the types of functions not
allowed are user-defined, SQL aggregate functions.

Nov 12 '05 #3

P: n/a
"Ed Havelaar" <e.********@it.canterbury.ac.nz> wrote in message
news:8a******************************@news.teranew s.com...
I have a cool function that I want to use as a default value for a column in my table. But I can't because apparently Access doesn't allow user defined functions in expressions for default values. It's very annoying. Is there any way around it?

What I need is something like AutoNumber, *except* I want the values to be
unique across six different tables. Any ideas?
Unknown function <name> in validation expression or default value on <name>. (Error 3388)
The function you are referencing is either unknown (because the name is
invalid or misspelled) or is a type of function not allowed by the
ValidationRule or DefaultValue property. Among the types of functions not
allowed are user-defined, SQL aggregate functions.


This is one of many reasons why databases have forms for data entry rather
than entering the data directly into the tables. This gives you far greater
flexibility and control over what happens. If you used a form, you could
either simply set the default value of your textbox to your cool function,
or you could use the form's events (such as BeforeInsert) to write any code
you like.
If you gave further details about the background to your need for a number
to be unique across 6 tables (such as is this number used as a key in other
tables) perhaps you would get some ideas. Who knows perhaps all 6 tables
should be combined into 1, perhaps another table should have an autonumber
with these tables related 1:1 with the main table, or perhaps your custom
function is indeed the best solution. It's difficult to say without further
details.

Fletcher
Nov 12 '05 #4

P: n/a
On Sat, 10 Jan 2004 04:56:02 GMT, "Ed Havelaar"
<e.********@it.canterbury.ac.nz> wrote:
What I need is something like AutoNumber, *except* I want the values to be
unique across six different tables. Any ideas?


What problem do you believe a value "unique across six different
tables" will solve?

--
Mike Sherrill
Information Management Systems
Nov 12 '05 #5

P: n/a
Mike Sherrill <MS*************@compuserve.com> wrote in
news:uc********************************@4ax.com:
On Sat, 10 Jan 2004 04:56:02 GMT, "Ed Havelaar"
<e.********@it.canterbury.ac.nz> wrote:
What I need is something like AutoNumber, *except* I want the values to be
unique across six different tables. Any ideas?


What problem do you believe a value "unique across six different
tables" will solve?


Group sex in pool halls?

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.