Parsing part of a date or getting just the day part of the date...

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Sounds confusing I know. I have a order number (1). I want to add the date
to it to make a code. So on 20/july/2005 I would like to have 1-20. meaning
the first order on the 20th. I have tried many of the date functions to get
just the day/date, but have been unsuccessful. I remember that in the past I
did something in a query to grab just the first part, but do not remember.
We use the dd/mm/yyyy format here.
Thank you for your help
Michael
 
Have you tried the Day Function?

Day([YourDate])

alternatively there's the DatePart Function which gives lots more options,
just search the Access help.

hth

Chris
 
Michael said:
Sounds confusing I know. I have a order number (1). I want to add the
date to it to make a code. So on 20/july/2005 I would like to have
1-20. meaning the first order on the 20th. I have tried many of the
date functions to get just the day/date, but have been unsuccessful.
I remember that in the past I did something in a query to grab just
the first part, but do not remember. We use the dd/mm/yyyy format
here.
Thank you for your help
Michael

My advice is to store the number and "DateCreated" in two separate fields.
It is then a lot easier to get the Max value of the numeric field so you can
assign the next one and it is trivial to *display* on your forms and reports
a pseudo field that gives you the format you want.

=[OrderNumber] & Format([CreatedDate], "dd")

In addition you don't store two pieces of information in a single field
which violates proper database design rules.
 
You can do this.

NewOrdNum = Me!OrdNum & "-" & Format(Me!YourDate, "dd/mmmm/yyyy")

Ron
 
Back
Top