Split function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to use the split function to seperate my date field into day,
month, and year fields. Every time I try to run the Split([Date], "/"])(0)
to get the day I get an error reading "The expression you entered contains
invalid syntax." what am I doing wrong.
 
Split will not work as the date is stored as a number. Use date functions --
Year([YourField])
Month([YourField])
Day([YourField])
 
Not sure, but I think the split function is used with a string. A date
field does not have a "/" in it. It may display with one, but that is just
a display.

Also, I hope your field is not called "Date" as that is a reserved word and
would get quite confusing to access.


I would use the built-in functions to pull out parts of the date...

Month([SomeDateField])

....would give you the month.


You might also look at the "datepart" function.
 
Thanks
helped alot

KARL DEWEY said:
Split will not work as the date is stored as a number. Use date functions --
Year([YourField])
Month([YourField])
Day([YourField])

mike said:
I'm trying to use the split function to seperate my date field into day,
month, and year fields. Every time I try to run the Split([Date], "/"])(0)
to get the day I get an error reading "The expression you entered contains
invalid syntax." what am I doing wrong.
 
Thanks for the help
My field is actually titled "Date Captured" is that gonna cause problems?


Rick B said:
Not sure, but I think the split function is used with a string. A date
field does not have a "/" in it. It may display with one, but that is just
a display.

Also, I hope your field is not called "Date" as that is a reserved word and
would get quite confusing to access.


I would use the built-in functions to pull out parts of the date...

Month([SomeDateField])

....would give you the month.


You might also look at the "datepart" function.


--
Rick B



mike said:
I'm trying to use the split function to seperate my date field into day,
month, and year fields. Every time I try to run the Split([Date], "/"])(0)
to get the day I get an error reading "The expression you entered contains
invalid syntax." what am I doing wrong.
 
That field should not give a problem but some folks go so far as the use an
underscore instead of space in field titles (Date_Captured) or no separator
with capitailization (DateCaptured). Then they put public labels for the
displays.

mike said:
Thanks for the help
My field is actually titled "Date Captured" is that gonna cause problems?


Rick B said:
Not sure, but I think the split function is used with a string. A date
field does not have a "/" in it. It may display with one, but that is just
a display.

Also, I hope your field is not called "Date" as that is a reserved word and
would get quite confusing to access.


I would use the built-in functions to pull out parts of the date...

Month([SomeDateField])

....would give you the month.


You might also look at the "datepart" function.


--
Rick B



mike said:
I'm trying to use the split function to seperate my date field into day,
month, and year fields. Every time I try to run the Split([Date], "/"])(0)
to get the day I get an error reading "The expression you entered contains
invalid syntax." what am I doing wrong.
 
Back
Top