Solved DateAdd Format (Medium Date) (1 Viewer)

Lochwood

Registered User.
Local time
Today, 08:10
Joined
Jun 7, 2017
Messages
130
Here is my code but i would like it to report Medium Date Medium Date.. the actual field and table format is medium date.

Code: between the" & " " &DateAdd("m", -1, Forms![TRHA]![Medical_Due_Subform].Form![Medical_Due]) & " " & "and" & " " & Forms![TRHA]![Medical_Due_Subform].Form![Medical_Due] _

Output: Between the 05/04/2021 and 05-May-21

I am trying to get output to Between the 05-Apr-21 and 05-May-21

Any guidance would be great.. thanks.
 

bob fitz

AWF VIP
Local time
Today, 16:10
Joined
May 23, 2011
Messages
4,726
Try:
Code: between the " & DateAdd("m", -1, Format(Forms![TRHA]![Medical_Due_Subform].Form![Medical_Due],"dd/mmm/yy")) & " and " & Forms![TRHA]![Medical_Due_Subform].Form![Medical_Due] _
 

Minty

AWF VIP
Local time
Today, 16:10
Joined
Jul 26, 2013
Messages
10,367
A couple of things - don't format your dates in the table, it's only a representation of the data stored, and could hide a time value that you might not know was present.
Always apply formats either in the report or the forms. It's more efficient and allows you to see the real data in your underlying queries when developing.

Try

Code: between the " & Format(DateAdd("m", -1, Forms![TRHA]![Medical_Due_Subform].Form![Medical_Due]),"dd-mmm-yy") & " and " & Forms![TRHA]![Medical_Due_Subform].Form![Medical_Due] _

Edit: Dang- slow fingers @bob fitz beat me to it
 
Last edited:

bob fitz

AWF VIP
Local time
Today, 16:10
Joined
May 23, 2011
Messages
4,726
A couple of things - don't format your dates in the table, it's only a representation of the data stored, and could hide a time value that you might not know was present.
Always apply formats either in the report or the forms. It's more efficient and allows you to see the real data in your underlying queries when developing.

Try

Code: between the " & Format(DateAdd("m", -1, Forms![TRHA]![Medical_Due_Subform].Form![Medical_Due]),"dd-mmm-yy" & " and " & Forms![TRHA]![Medical_Due_Subform].Form![Medical_Due] _

Edit: Dang- slow fingers @bob fitz beat me to it
Actually, our suggestions differ slightly, but I think that both would work :)
 

Lochwood

Registered User.
Local time
Today, 08:10
Joined
Jun 7, 2017
Messages
130
A couple of things - don't format your dates in the table, it's only a representation of the data stored, and could hide a time value that you might not know was present.
Always apply formats either in the report or the forms. It's more efficient and allows you to see the real data in your underlying queries when developing.

Try

Code: between the " & Format(DateAdd("m", -1, Forms![TRHA]![Medical_Due_Subform].Form![Medical_Due]),"dd-mmm-yy" & " and " & Forms![TRHA]![Medical_Due_Subform].Form![Medical_Due] _

Edit: Dang- slow fingers @bob fitz beat me to it
Minty your solution worked.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:10
Joined
May 7, 2009
Messages
19,227
both missed the last Format:

"Between the " & Format(DateAdd("m", -1, Forms![TRHA]![Medical_Due_Subform].Form![Medical_Due]), "dd-mmm-yy") & " and " & Format(Forms![TRHA]![Medical_Due_Subform].Form![Medical_Due], "dd-mmm-yy")
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:10
Joined
May 7, 2009
Messages
19,227
not missed but only the "missed" part has correct output. :ROFLMAO:
 

Users who are viewing this thread

Top Bottom