Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string to date

Status
Not open for further replies.

wdbouk

Technical User
May 28, 2003
81
CA
Hi,

i am wondering how to update columns with dates like 8/20/1991 to date number like 33470
thx
 
Not sure what you're asking. DateTime fields are already stored as numbers. The "8/20/1991" form is only a formatting thing. If you want to see the number in a query then
Code:
cDbl(DateTimeField)
should give it to you.
 
UPDATE Prices SET cDbl(Date); I am receiving a syntax error. i want my dates in teh date column to be in a number format and not the mm/dd/year format
 
First of all, that's an invalid statement. An update statement has the form
Code:
UPDATE myTable SET fld = Value
You're missing the " = Value" part.

Second ... as I said ... Access wants to present DateTime fields in some DateTime format such as "8/20/1991". Those values are already in the database as numbers. You are attempting to change the formatting by changing the stored value. You need to make the change where the data is presented ... not how it is stored. For example
Code:
Select cDbl(DateTimeField) As DateNumber
From myTable
Should display the numeric value for the date.
 
Simply use # as display format.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top