Solved

can't pass NULL value

Posted on 2014-09-04
4
102 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
  • 3
4 Comments
 
LVL 45

Accepted Solution

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

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 45

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
DO Loop not working 4 63
Controlling which port to download from 4 58
VBA color chart bars 12 65
How to Add / Edit Windows Menu 4 23
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now