Solved Extracting Month name (1 Viewer)

sbaud2003

Member
Local time
Tomorrow, 03:05
Joined
Apr 5, 2020
Messages
178
I have a query based on relation ship of two tables having common field (primary key) Called DV contain value like 11 of 04/2020, means sl no 11 of April 2020, I wanted to get the month name from DV by using formula MN: MonthName(Left(Right([DV],7),2)), but it gives error showing this DV could refer to both the table. In there any way to extract the data from this field.
 

Minty

AWF VIP
Local time
Today, 22:35
Joined
Jul 26, 2013
Messages
10,371
I think we would need to see a decent sample of your data to be able to give a correct answer?
Only seeing one value doesn't tell us enough I'm afraid.
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 07:35
Joined
Jan 20, 2009
Messages
12,852
Refer to one of the tables.
Right(tablename.DV,7)
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:35
Joined
Feb 28, 2001
Messages
27,172
If your format is fixed at "n of mm/yyyy" then

Mnumber = MID$( DV, ( Instr$( 1, DV, "/" ) - 2 ), 2 )

I included an extra parenthesis pair simply to clarify the arguments. You could omit the parentheses that are in red if you wished. If you are not up on VBA then that MID formula says "find the slash, step back two characters, and take two characters." This is how you would use it in VBA, but it is possible to use MID in a query as well. It's just clunkier if you do.

If this format is NOT always the same, then the problem gets trickier and we would need to see samples of various contents of DV.
 

Users who are viewing this thread

Top Bottom