Solved

can't pass NULL value

Posted on 2014-09-04
4
106 Views
Last Modified: 2014-09-04
When trying to test for NULL values, I am not able to pass the code below on line 10 when the value is NULL.  Is there something wrong with my syntax on that line?

When debugging, I find that the value is indeed NULL, but it won't pass onto line 11



MonthlyID = 5
ActivityID = 2

If rec.State = adStateOpen Then
        
       rec.MoveFirst
       i = 1
        Do While Not rec.EOF
        
                If rec!ProgressSetback Is Nothing Then
                    If MSFlexGrid1.TextMatrix(i, 9) <> "" Then
                    sStringtoEx = "insert into tblOrgMonthlyProgressSetbacks (PIID, monthlyid, agencyid, progresssetback) values " & _
                    "(" & MSFlexGrid1.TextMatrix(i, 4) & "," & MonthlyID & "," & AgencyID & ",'" & MSFlexGrid1.TextMatrix(i, 9) & "')"
                    Set rec = conn.Execute(sStringtoEx)
                    End If
                End If
                
                If rec!ProgressSetback <> "" Then
                    If MSFlexGrid1.TextMatrix(i, 9) <> "" Then
                    sStringtoEx = "update tblOrgMonthlyProgressSetbacks set progresssetback= '" & MSFlexGrid1.TextMatrix(i, 9) & "' where PIID = " & MSFlexGrid1.TextMatrix(i, 4) & ""
                    Set rec = conn.Execute(sStringtoEx)
                    End If
                End If
                i = i + 1
                rec.MoveNext
   
        Loop
End If

Open in new window

0
Comment
Question by:al4629740
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 47

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40304222
If IsNull(rec!ProgressSetback) Then
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40304225
Or maybe

If rec!ProgressSetback & " " = " " Then
0
 
LVL 15

Expert Comment

by:ChloesDad
ID: 40304676
As has been implied, NULL and NOTHING are not the same, although it is quite a common error to assume that they are.

Nothing means that the variable does not have an object assigned to it,

Null means that it does have an object assigned to it, but the objects value is NULL
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40304762
I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

710 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