Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

can't pass NULL value

Posted on 2014-09-04
4
Medium Priority
?
108 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 49

Accepted Solution

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

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 49

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

715 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