我想創建一個Microsoft Access應用程序需要幫助。 我創建了一個數據庫,可以獲取多個日期。我需要計算日期和OMIT星期二,星期四,星期六和星期日在櫃檯之間的天數。這是在兩個不同的時間間隔(NotificationDate到OrderDate)和(PlacementDate到ReleaseDate)之間Microsoft Access和Visual Basic - 需要幫助運行模塊
我的問題是,現在我寫了它,我如何在Microsoft Access中實際使用它?我如何從表單運行它?
'//////This is for Valley Estimate of Demurrage Days/////////////
Public Function Weekdays(ByRef NotificationDate As Date, ByRef OrderDate As Date, ByRef PlacementDate As Date, ByRef ReleaseDate As Date) As Integer
Dim numWeekdays As Integer
Dim totalDays As Integer
Dim totaldays2 As Integer
Dim WeekendDays As Integer
Dim WeekendDays2 As Integer
numWeekdays = 0
WeekendDays = 0
WeekendDays2 = 0
totalDays = DateDiff(dateinterval.Day, NotificationDate, OrderDate) + 1
'for i as integer = 1 to totalDays
If DatePart(dateinterval.Weekday, NotificationDate) = 1 Then
WeekendDays = WeekendDays + 1
End If
If DatePart(dateinterval.Weekday, startDateNotificationDate) = 3 Then
WeekendDays = WeekendDays + 1
End If
If DatePart(dateinterval.Weekday, NotificationDate) = 5 Then
WeekendDays = WeekendDays + 1
End If
If DatePart(dateinterval.Weekday, NotificationDate) = 7 Then
WeekendDays = WeekendDays + 1
End If
NotificationDate = DateAdd("d", 1, NotificationDate)
'///////////////////////////////////////////////////////////////////////////
totaldays2 = DateDiff(dateinterval.Day, PlacementDate, ReleaseDate) + 1
If DatePart(dateinterval.Weekday, PlacementDate) = 1 Then
WeekendDays2 = WeekendDays2 + 1
End If
If DatePart(dateinterval.Weekday, PlacementDate) = 3 Then
WeekendDays2 = WeekendDays2 + 1
End If
If DatePart(dateinterval.Weekday, PlacementDate) = 5 Then
WeekendDays2 = WeekendDays2 + 1
End If
If DatePart(dateinterval.Weekday, PlacementDate) = 7 Then
WeekendDays2 = WeekendDays2 + 1
End If
PlacementDate = DateAdd("d", 1, PlacementDate)
numWeekdays = WeekendDays + WeekendDays2
End Function
好的,非常感謝,這更符合我所尋找的內容。我現在將測試它 – NavyNuke