Hello,

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I need to use "Last_Day" function in Oracle. For example,
SELECT NEXT_DAY('02-FEB-2001','TUESDAY') "NEXT DAY"
FROM DUAL;

NEXT DAY
-----------
06-FEB-2001

Could someone tell me the ways of implementing Last_Day functions in Access?

Thanks in advance :)

Daniel
 
Hi -

Try copying/pasting to a standard module, then test from debug (immediate)
window as shown:

Function fNextNthDay(dteStart As Date, _
intWeekday As Integer) As Date
'**************************************************
'Purpose: Round date up to next specified
' weekday
'Inputs: 1) ? fNextNthDay(#4/18/06#, vbWednesday)
' 2) ? fNextNthDay(#4/19/06#, vbWednesday)
' 3) ? fNextNthDay(#4/20/06#, vbWednesday)
'Output: 1) 4/19/06
' 2) 4/19/06
' 3) 4/26/06
'**************************************************
fNextNthDay = dteStart - WeekDay(dteStart) + _
intWeekday + _
IIf(WeekDay(dteStart) > intWeekday, 7, 0)

End Function

HTH - Bob
 
I don't know what Last_day means, but if it is to get the last day of a
given month, try:


DateSerial( WantedYear, WantedMonth + 1, 0)


? DateSerial( 2007, 06+1, 0)
2007.06.30


and if you want next day :


DateSerial( WantedYear, WantedMonth, WantedDay + 1 )

? DateSerial( 2007, 06, 30+1)
2007.07.01




Hoping it may help,
Vanderghast, Access MVP
 
sgyan1 said:
Hello,

I need to use "Last_Day" function in Oracle. For example,
SELECT NEXT_DAY('02-FEB-2001','TUESDAY') "NEXT DAY"
FROM DUAL;

NEXT DAY
-----------
06-FEB-2001

Could someone tell me the ways of implementing Last_Day functions in Access?

Thanks in advance :)

Daniel

Daniel,

If you have Oracle installed on your PC, and that installation offers an object library
that you can check a reference to, check that reference* and then test if MS Access will
allow you to use the Oracle function.

* MS Access Menus: Tools > Macros > Visual Basic Editor
Visual Basic Editor Menus: Tools > References...


Sincerely,

Chris O.
 
and if you want the end of the week (assuming the end of the week is
friday):


yourDate + Choose( DatePart( "w", yourDate), 6, 5, 4, 3, 2, 1, 0, -1)

as in :

? date() + Choose(DatePart("w", date()), 6, 5, 4, 3, 2, 1, 0, -1)
2007.06.30



For a saturday, instead of a friday, change the sequence to: 7, 6, 5, 4, 3,
2, 1, 0




Vanderghast, Access MVP
 
Back
Top