[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VB - Invalid use of Null: CInt - Trying to use value from DATEDIFF as an Index for an array.

Posted on 2004-11-08
3
Medium Priority
?
259 Views
Last Modified: 2008-02-07
I'm guessing that it's going to be something obvious for someone, but I can't see it.   I'm counting up the number of cases based upon how old they are. Below is my code, and I get the error on the DateDiff line.

ERROR: Invalid use of Null: 'CInt'

_____________________________________________

Do While Not rsClientInfo.EOF

   If rsClientInfo("CaseOpenDate") = Null Then
       Response.Write "This is BS" & rsClientInfo("CaseNumber")   ' <-- None Found
   Else
       YearsOpen = CInt(DATEDIFF("y", rsClientInfo("CaseOpenDate"), Now()))
       If YearsOpen > 4 Then
          YearsOpen = 4
       End If
       CaseCount(YearsOpen) = CaseCount(YearsOpen) + 1      
   End if
            
rsClientInfo.MoveNext
Loop
0
Comment
Question by:jahworld
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
RogueSolutions earned 400 total points
ID: 12526524
I think your test of Null is the suspect part

Try

     If IsNull(rsClientInfo("CaseOpenDate")) Then

The fact that the Nulls are not being picked by your test means the CInt can get passed nonsense.



0
 

Author Comment

by:jahworld
ID: 12526600
Damnit......I knew it was something obvious.

Thanks!!
0
 
LVL 5

Expert Comment

by:RogueSolutions
ID: 12526630

Yeah, but neither vb nor the database can be bothered to complain so what can you do ;)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month20 days, 4 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question