Why Am I getting Overflow Error????? VBA/ ACCESS -


Please help me identify what I'm doing wrong. I'm getting an overflow error with the section "Weekend Day = Weekend + 1" highlight, the purpose of this code is to calculate in the 2 dates range on Tuesdays, Thursdays, Saturdays and Sundays.

  '////// This Demurge Days / //////////// Public Works Modeway (ByRef Notification Date as Date, ByRef as Date Round date date as date date, Date as date of date, Date as date of reef release date as integer) Integer dim weekend as integer slow weekend day 2 left as integer '= 0 WeekendDays = 0 WeekendDays2 = 0, then DatePart ("W", NotificationDate) = 0 then WeekendDays = WeekendDays + 1 elseif DatePart ("D Lyu ", NotificationDate) = 2 then WeekendDays = WeekendDays + 1 elseif DatePart (" w ", NotificationDate) = 4 then WeekendDays = WeekendDays + 1 elseif DatePart (" w ", NotificationDate) = 6 then WeekendDays = WeekendDays +1 end of the loop By NotificationDate = OrderDate do DatePart ( "w", PlacementDate) = 0 then WeekendDays2 = Vikanddiyjh 2 + 1 Aelsaiaf Dinankpert ( "W", placement date) = 2 then WeekendDays2 = WeekendDays2 + 1 elseif DatePart ( "w", PlacementDate) = 4 then WeekendDays2 = WeekendDays2 + 1 gives elseif DatePart ( "w", PlacementDate) = 6 then WeekendDays2 = WeekendDays +1 end loop leave PlacementDate = RELEASEDATE until = WeekendDays + weekend Day 2 skips = ModWeekdays (notification, order date, placement date, release date) and function  

< P> If you increase your variable, then you are in an infinite loop, it should fix back and forth from our observations.

Your function should look like this:

  '////// This is for the valley Damurraj Days Estimated ///////// as //// public function mode Vekdedejh (date as ByRef notification date, according to ByRef order, date as the date ByRef placement, date as integer as Reef retarded release date) integer dim weekend In the integer dim WeekendDays2 'as integer' leaves = 0 weeken dDays = 0 WeekendDays2 = 0 Do DatePart (the "W", NotificationDate) = 0 Then WeekendDays = WeekendDays + 1 elseif DatePart ( "w", NotificationDate) = 2 then WeekendDays = WeekendDays + 1 elseif DatePart ( "w", NotificationDate) = 4 then WeekendDays = WeekendDays + 1 elseif DatePart ( "w", NotificationDate) = 6 then WeekendDays = WeekendDays +1 end if 'it increments the line you were missing NotificationDate = DATEADD ( "D", 1, notification Date ) By the date of notification loop = order date if dated ("W", placement date) = 0 then WeekendDays2 = WeekendDays2 + 1 elseif DatePart ("W", PlacementDate) = 2 again WeekendDays2 = WeekendDays2 + 1 e Lseif DatePart ("W", PlacementDate) = 4 then WeekendDays2 = WeekendDays2 + 1 elseif DatePart ("W", PlacementDate) = 6 then Weekend's 2 = Weekends + 1 and if 'This is the increment line that you were missing PlacementDate , Add date ('D', 1, Placement date) till the placement dot = Release Date 'Equal to' ModWeekdays 'so that you can return the value' Also, delete the last line, which again Calls and Vekedes an infinite loop mode = Weekend + weekendday 2 termination function  

Then, you will call it with your button (or whatever you are doing to run this function):

  DatesToSkip (Date1, Date2, Date3, Date 4)  
as the TotalDaysToSkip = ModWeekdays

Comments