Default Value Take 2

  • Thread starter Thread starter David
  • Start date Start date
D

David

Don't know why but this post didnt go through the first time after 20 mins.
Sry if it gets posted twice.

Hi All,

I want to use this query as my default value for a date field.

SELECT DISTINCT TOP 1 Routes.OrderDate
FROM Routes
ORDER BY Routes.AutoNumber DESC;

I tried making this into a query and set the fields default value to the
query, but I always get #name as the default value. Any ideas on how to
make this work properly?

Thanks,

Dave
 
I doubt "autonumber" is a field name in your table. It is more likely to be
data type.

I also doubt that you really want to be sorting on that field. If you are
trying to set the last date as the default date you will need to use the max
or dmax function.

or maybe I do not understand the problem.
 
Don't know why but this post didnt go through the first time after 20 mins.
Sry if it gets posted twice.

Hi All,

I want to use this query as my default value for a date field.

A Table default value cannot be based on that (or any other) table,
nor on a user defined function, nor on a query.

You can set the DefaultValue property of a *form* control to, e.g.,

DMax("[OrderDate]", "[Routes]")

and use that form to update your table.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top