aggregate function

S

samuel

i import a table with this value as the timestamp (seen as a text data type)

[xact_dat_x]
2005112602465800

i want a query to extract the month..

Date: Format(Left([xact_dat_x],8),"mm") gives an error .

help.
 
R

Rick Brandt

samuel said:
i import a table with this value as the timestamp (seen as a text
data type)

[xact_dat_x]
2005112602465800

i want a query to extract the month..

Date: Format(Left([xact_dat_x],8),"mm") gives an error .

help.

The Format function (when fed "mm" as the format argument) expects an Access
DateTime to be fed in as the input. The first 8 characters of your field is not
a DateTime, but rather a String. For your Format function to work you would
first have to convert that String into a DateTime.

Since "mm" only gives the number for the month anyway just use the Mid fiunction
to grab those characters...

=Mid([xact_dat_x], 5, 2)
 
K

KARL DEWEY

Access is not recognizing your data as a date.
If you want the month from it use –
Right(Left([xact_dat_x],6),2)
 
S

samuel

thanks for the help.

would it be possible to display Nov instead of 11 ?

KARL DEWEY said:
Access is not recognizing your data as a date.
If you want the month from it use –
Right(Left([xact_dat_x],6),2)


samuel said:
i import a table with this value as the timestamp (seen as a text data type)

[xact_dat_x]
2005112602465800

i want a query to extract the month..

Date: Format(Left([xact_dat_x],8),"mm") gives an error .

help.
 
S

samuel

PERFECT!!

thanks so much...

KARL DEWEY said:
Format(DateSerial(Left([xact_dat_x],4),Right(Left([xact_dat_x],6),2),Right(Left([xact_dat_x],8),2)),"mmm")

Or this for full spelling
Format(DateSerial(Left([xact_dat_x],4),Right(Left([xact_dat_x],6),2),Right(Left([xact_dat_x],8),2)),"mmmm")

samuel said:
thanks for the help.

would it be possible to display Nov instead of 11 ?

KARL DEWEY said:
Access is not recognizing your data as a date.
If you want the month from it use –
Right(Left([xact_dat_x],6),2)


:

i import a table with this value as the timestamp (seen as a text data type)

[xact_dat_x]
2005112602465800

i want a query to extract the month..

Date: Format(Left([xact_dat_x],8),"mm") gives an error .

help.
 
D

Douglas J. Steele

Vincent Johns said:
... which is what I would suggest, too, but if you want a month name you
could use something like

Format(Mid([xact_dat_x],5,2) & "/1/2005","mmmm")


Just a warning. That won't work for users who have their short date form set
(in Regional Setting) to dd/mm/yyyy: it'll return January in all cases.

Far safer is:

Format(DateSerial(2005, Mid([xact_dat_x],5,2) , 1), "mmmm")
 
K

KARL DEWEY

Format(DateSerial(Left([xact_dat_x],4),Right(Left([xact_dat_x],6),2),Right(Left([xact_dat_x],8),2)),"mmm")

Or this for full spellin
Format(DateSerial(Left([xact_dat_x],4),Right(Left([xact_dat_x],6),2),Right(Left([xact_dat_x],8),2)),"mmmm")

samuel said:
thanks for the help.

would it be possible to display Nov instead of 11 ?

KARL DEWEY said:
Access is not recognizing your data as a date.
If you want the month from it use –
Right(Left([xact_dat_x],6),2)


samuel said:
i import a table with this value as the timestamp (seen as a text data type)

[xact_dat_x]
2005112602465800

i want a query to extract the month..

Date: Format(Left([xact_dat_x],8),"mm") gives an error .

help.
 
M

Marshall Barton

KARL said:
If you want the month from it use –
Right(Left([xact_dat_x],6),2)


But, Karl, that's just the long way around to the Mid
function that everyone else used.
 
Top