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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems displaying Month Date Format in Table 1

Status
Not open for further replies.

Drepso

Technical User
Jul 22, 2002
50
AU
I am currently having problems displaying a date/time value to corresponding fields in a table.

I need to split a date/time field into 3 fields. These are:
1. Day of Month
2. Month of Year
3. Day of Week

The current format of the source date/time field is dd/mm/yyyy.

I have successfully appended this data for Day of Month & Day of Week but using the same method I am receiving incorrect data for the month. Eg. January instead of July.

This is an example of the expressions I have used in part of my append query:

Expr: Day([Source Day/Time]![cr_time])
Expr: Month([Source Day/Time]![cr_time])
Expr: Weekday([Source Day/Time]![cr_time])

These fields are appended to their corresponding fields in a summary table.

I have set the format for Weekday to (dddd), and have used the same principle for the month (mmmm). This is the one I am having trouble with as it always returns January instead of July (working with a July month data set)

I used the expression builder as I am not too flash with SQL (ie. basic.. but learning)

Hope the above information is enough and someone can help me.

Thanks

 
Hi

The Function MOnth() returns an integer in the range 1-12, so if you are getting the word January you must be doing something else to it, could the problem lie there?

Regards

Ken Reay

 
Thanks mate...sorted the problem out. Does the function weekday() return an integer as well. This is where I got confused as I set the format in the destination table for this field to (Date/Time) and (dddd).

This returned the weekdays I needed and I assumed that months would work on the same principle.

All in all your post helped me fix the problem but I am still curious why the weekday function worked.

Thanks again



 
Hi

Yes, I am curious too, see results below:
debug.Print weekday(date())
4
debug.Print Format(weekday(Date()),"dddd")
Wednesday
debug.Print Month(date())
8
debug.Print Format(Month(date()),"mm")
01
debug.Print Format(Month(date()),"mmm")
Jan
debug.Print Format(Month(date()),"mmmm")
January

The above is with Access97, which version are you using?

Regards

Ken Reay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top