?
Solved

How do I format a date using Expression Builder?

Posted on 2009-02-11
3
Medium Priority
?
260 Views
Last Modified: 2013-11-28
The dates produced by the code below produce formats like the following:
01/01/09, 12/01/09, 01/10/09...
I want them to look like the following:
1-1-09, 12-1-09, 1-10-09...
Can I do that in the code produced, or if not, what are my alternatives?
=Switch
([DepartmentCode]="A","Interim Billing Administrative Services from " & " " & [StartDate] & " to " & [EndDate],
[DepartmentCode]="B","Interim Billing Survey Services from" & " " & [StartDate] & " to " & [EndDate],
[DepartmentCode]="C","Interim Billing Civil Services from" & " " & [StartDate] & " to " & [EndDate],
[DepartmentCode]="D","Interim Billing Architectural Services from" & " " & [StartDate] & " to " & [EndDate],
[DepartmentCode]="F","Interim Billing Forensic Services from" & " " & [StartDate] & " to " & [EndDate],
[DepartmentCode]="S","Interim Billing Structural Services from" & " " & [StartDate] & " to " & [EndDate])

Open in new window

0
Comment
Question by:pmcontractor
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 23618134
example:

Format([StartDate],"m-d-yy")



=Switch
([DepartmentCode]="A","Interim Billing Administrative Services from " & " " & Format([StartDate],"m-d-yy") & " to " & [EndDate],
[DepartmentCode]="B","Interim Billing Survey Services from" & " " & [StartDate] & " to " & [EndDate],
[DepartmentCode]="C","Interim Billing Civil Services from" & " " & [StartDate] & " to " & [EndDate],
[DepartmentCode]="D","Interim Billing Architectural Services from" & " " & [StartDate] & " to " & [EndDate],
[DepartmentCode]="F","Interim Billing Forensic Services from" & " " & [StartDate] & " to " & [EndDate],
[DepartmentCode]="S","Interim Billing Structural Services from" & " " & [StartDate] & " to " & [EndDate])
0
 

Author Closing Comment

by:pmcontractor
ID: 31545875
I overlooked the obvious...works like a charm! Thanks
0
 
LVL 75
ID: 23618303
you are welcome.

mx
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question