PC Review


Reply
Thread Tools Rate Thread

DateSerial Troubles

 
 
=?Utf-8?B?cm9ja2VyeA==?=
Guest
Posts: n/a
 
      14th Mar 2007
I have some VB Script that I am writing. To make it simple, I am defining a
function as follows:

'The Code
Function AAAAA(TAKT As String, WeekEnds As String, BuildAhead As String,
DueDate As String, Shifts As String, HoursPerDay As String) As Integer

Dim iDailyProduction As Integer
Dim iBuildAheadTime As Integer
Dim iWeekEndDays As Integer
Dim StraightStartDate As Date
Dim t As Integer
Dim iWeekEndDaysInPeriod As Integer
Dim iDay As Integer

Select Case UCase(WeekEnds)
Case "SUN"
iDay = 1
Case "SAT"
iDay = 7
End Select

iDailyProduction = 3600 * (HoursPerDay - 0.5) / TAKT
iBuildAheadTime = (BuildAhead / iDailyProduction)
AAAAA = DateSerial(1989, 5, 15)

End Function

This is not the complete code, I have eliminated some of it for
troubleshooting purposes.

The problem I am running into is: if I any year less than 1990, the function
operates coorectly. For any date 1990 or greater, the function returns the
#VALUE! error in the cell.

Any ideas?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      14th Mar 2007
change the type of your function. Change

Function AAAAA(TAKT As String, WeekEnds As String, BuildAhead As String,
DueDate As String, Shifts As String, HoursPerDay As String) As Integer

to

Function AAAAA(TAKT As String, WeekEnds As String, BuildAhead As String,
DueDate As String, Shifts As String, HoursPerDay As String) As Long

or

Function AAAAA(TAKT As String, WeekEnds As String, BuildAhead As String,
DueDate As String, Shifts As String, HoursPerDay As String) As Date

--
Regards,
Tom Ogilvy

"rockerx" wrote:

> I have some VB Script that I am writing. To make it simple, I am defining a
> function as follows:
>
> 'The Code
> Function AAAAA(TAKT As String, WeekEnds As String, BuildAhead As String,
> DueDate As String, Shifts As String, HoursPerDay As String) As Integer
>
> Dim iDailyProduction As Integer
> Dim iBuildAheadTime As Integer
> Dim iWeekEndDays As Integer
> Dim StraightStartDate As Date
> Dim t As Integer
> Dim iWeekEndDaysInPeriod As Integer
> Dim iDay As Integer
>
> Select Case UCase(WeekEnds)
> Case "SUN"
> iDay = 1
> Case "SAT"
> iDay = 7
> End Select
>
> iDailyProduction = 3600 * (HoursPerDay - 0.5) / TAKT
> iBuildAheadTime = (BuildAhead / iDailyProduction)
> AAAAA = DateSerial(1989, 5, 15)
>
> End Function
>
> This is not the complete code, I have eliminated some of it for
> troubleshooting purposes.
>
> The problem I am running into is: if I any year less than 1990, the function
> operates coorectly. For any date 1990 or greater, the function returns the
> #VALUE! error in the cell.
>
> Any ideas?

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Help with DateSerial John W. Vinson Microsoft Access Queries 2 24th Mar 2009 06:04 PM
Re: Help with DateSerial John W. Vinson Microsoft Access Queries 0 20th Mar 2009 01:17 AM
Help with IIF DateSerial exp Bill Fischer via AccessMonster.com Microsoft Access Queries 2 15th Feb 2006 05:09 AM
Login Troubles and Start Menu troubles Jono Windows XP Help 2 30th Jul 2004 03:12 PM
DateSerial Mike Golla Microsoft Access Queries 2 3rd Oct 2003 12:45 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:55 AM.