Default Value

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

David

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
 
You can't use SQL (nor DLookup) to set the default value.

If this is in a form, put logic in the form's Load event to set the default
value of the field.

If it's in a table, I'm afraid you're out of luck.
 
Douglas said:
You can't use SQL (nor DLookup) to set the default value.

If this is in a form, put logic in the form's Load event to set the default
value of the field.

They could alternatively put the logic in an INSERT within a SQL
procedure ('parameter query') removing permissions from the base table
to ensure only the proc is ever used to add a row. This would provide
the same logic to all applications that use the database, rather than
leaving the data integrity at the mercy of anyone with the ability to
connect e.g. using Excel.

Jamie.

--
 

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