Current date as default

  • Thread starter Thread starter norwedsh via AccessMonster.com
  • Start date Start date
N

norwedsh via AccessMonster.com

Hi,
I would like to be able to have the date set by default, as the
current date, when the table is created. I'm kinda new to SQL and am taking a
course in it. Here is my current SQL code:

create table
tblOrder
(
Order_ID counter,
Cus_ID integer,
Sale_Date Date,
Sale_Quantity integer,
Price currency,
Constraint Order_ID_PK primary key(order_id)
);

Sale_Date is the field in question, my instructor implied that the VB now()
function can be used, but I'm lost as how to use it.

Thanks in advance

Eric
 
Current date of what? "when the table is created"... implies the table. Do
you want the default date to be for a field within the table? You can do
that in the field's Default Value property.

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/
 
Um, Yes? He he. I want to make use of the default value property, I've been
having trouble with the syntax. The field sale_date should provide the
current date by default

thanks,

Eric

Jeff said:
Current date of what? "when the table is created"... implies the table. Do
you want the default date to be for a field within the table? You can do
that in the field's Default Value property.
Hi,
I would like to be able to have the date set by default, as the
[quoted text clipped - 18 lines]
 
Please re-read my response. The field (both at the table level and in a
form) has a Default value property, which you can set to be the current
date.

If you only want the date, you would use =Date(). If you want date/time,
use =Now().

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/


norwedsh via AccessMonster.com said:
Um, Yes? He he. I want to make use of the default value property, I've been
having trouble with the syntax. The field sale_date should provide the
current date by default

thanks,

Eric

Jeff said:
Current date of what? "when the table is created"... implies the table. Do
you want the default date to be for a field within the table? You can do
that in the field's Default Value property.
Hi,
I would like to be able to have the date set by default, as the
[quoted text clipped - 18 lines]
 
Yeah I know. My instructor want us to do it with SQL code! I don't want the
date the table is created, what I want is when the table is created to have
the current date entered by default when data is added to other fields. You
saw my code right? If I understand correctly there is a way to define that
Sale_Date has Now() as a default.

Eric

Jeff said:
Please re-read my response. The field (both at the table level and in a
form) has a Default value property, which you can set to be the current
date.

If you only want the date, you would use =Date(). If you want date/time,
use =Now().
Um, Yes? He he. I want to make use of the default value property, I've been
having trouble with the syntax. The field sale_date should provide the
[quoted text clipped - 15 lines]
 
You can do that (set a default value) in MS SQL Server. I'm don't believe
you can do it ins Access.


norwedsh via AccessMonster.com said:
Yeah I know. My instructor want us to do it with SQL code! I don't want
the
date the table is created, what I want is when the table is created to
have
the current date entered by default when data is added to other fields.
You
saw my code right? If I understand correctly there is a way to define that
Sale_Date has Now() as a default.

Eric

Jeff said:
Please re-read my response. The field (both at the table level and in a
form) has a Default value property, which you can set to be the current
date.

If you only want the date, you would use =Date(). If you want date/time,
use =Now().
Um, Yes? He he. I want to make use of the default value property, I've
been
having trouble with the syntax. The field sale_date should provide the
[quoted text clipped - 15 lines]
 

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

Similar Threads


Back
Top