-1

i have tis code in sql and it works but which function can i use in vba to archive the same result.

RIGHT('00' + MONTH(lt.LveFromDate),2) --2021-03 --2021-03 --YEAR(lt.LveFromDate)

james
  • 31
  • 6

1 Answers1

0

try,

Sub test()
  Dim s As String
  Dim myDate As Date
  
  myDate = Date
  s = Format(myDate, "yyyy-mm")
    
End Sub
Dy.Lee
  • 7,527
  • 1
  • 12
  • 14