<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Coding NULL in a field in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545144#M37173</link>
    <description>Not sure what you're trying to do.&lt;BR /&gt;
&lt;BR /&gt;
If you're trying to enter null values in the Access field, you should be &lt;BR /&gt;
able to just do&lt;BR /&gt;
&lt;BR /&gt;
field.value = null&lt;BR /&gt;
&lt;BR /&gt;
If you're having trouble dealing with null values coming out of the &lt;BR /&gt;
database, you can do something like&lt;BR /&gt;
&lt;BR /&gt;
        If IsNull(field.value) then&lt;BR /&gt;
            myvar = ""&lt;BR /&gt;
        Else&lt;BR /&gt;
            myvar = field.value&lt;BR /&gt;
        End if&lt;BR /&gt;
&lt;BR /&gt;
Hope this makes sense and that it helps you.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;RAGHUMN&gt; wrote in message news:5074125@discussion.autodesk.com...&lt;BR /&gt;
Hi all,&lt;BR /&gt;
&lt;BR /&gt;
Any idea on coding NULL values in a field of MS Access?&lt;BR /&gt;
Any small part of code or suggestion much appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
MNRaghu&lt;/RAGHUMN&gt;</description>
    <pubDate>Wed, 01 Feb 2006 13:41:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-02-01T13:41:06Z</dc:date>
    <item>
      <title>Coding NULL in a field</title>
      <link>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545142#M37171</link>
      <description>Hi all,&lt;BR /&gt;
&lt;BR /&gt;
Any idea on coding NULL values in a field of MS Access?&lt;BR /&gt;
Any small part of code or suggestion much appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
MNRaghu</description>
      <pubDate>Wed, 01 Feb 2006 13:07:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545142#M37171</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-02-01T13:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Coding NULL in a field</title>
      <link>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545143#M37172</link>
      <description>Raghu,&lt;BR /&gt;
&lt;BR /&gt;
Others like myself might need a bit more information.&lt;BR /&gt;
&lt;BR /&gt;
Within Acces dbText types have a property to allow zero length strings.  That will allow you to use Isnull() and VBNullString to determine if values exist within the data fields your evaluating.&lt;BR /&gt;
&lt;BR /&gt;
Hope that helps but if you expand your request a little there are some talented people with DB experience in this NG that can help.&lt;BR /&gt;
&lt;BR /&gt;
G'Luck&lt;BR /&gt;
&lt;BR /&gt;
Bob Coward</description>
      <pubDate>Wed, 01 Feb 2006 13:14:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545143#M37172</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-02-01T13:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Coding NULL in a field</title>
      <link>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545144#M37173</link>
      <description>Not sure what you're trying to do.&lt;BR /&gt;
&lt;BR /&gt;
If you're trying to enter null values in the Access field, you should be &lt;BR /&gt;
able to just do&lt;BR /&gt;
&lt;BR /&gt;
field.value = null&lt;BR /&gt;
&lt;BR /&gt;
If you're having trouble dealing with null values coming out of the &lt;BR /&gt;
database, you can do something like&lt;BR /&gt;
&lt;BR /&gt;
        If IsNull(field.value) then&lt;BR /&gt;
            myvar = ""&lt;BR /&gt;
        Else&lt;BR /&gt;
            myvar = field.value&lt;BR /&gt;
        End if&lt;BR /&gt;
&lt;BR /&gt;
Hope this makes sense and that it helps you.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;RAGHUMN&gt; wrote in message news:5074125@discussion.autodesk.com...&lt;BR /&gt;
Hi all,&lt;BR /&gt;
&lt;BR /&gt;
Any idea on coding NULL values in a field of MS Access?&lt;BR /&gt;
Any small part of code or suggestion much appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
MNRaghu&lt;/RAGHUMN&gt;</description>
      <pubDate>Wed, 01 Feb 2006 13:41:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545144#M37173</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-02-01T13:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Coding NULL in a field</title>
      <link>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545145#M37174</link>
      <description>To take the latter process one step further:&lt;BR /&gt;
&lt;BR /&gt;
I do a lot of programming involving both Access and AutoCad, so the issue of &lt;BR /&gt;
null fields and their conflict with string variables comes up a lot. There's &lt;BR /&gt;
an Nz function in Access VBA that checks whether a value is null, and if so &lt;BR /&gt;
returns something else that you specify. I wrote a little function in &lt;BR /&gt;
AutoCad VBA to do the same thing, as follows:&lt;BR /&gt;
&lt;BR /&gt;
Public Function tl_Nz(v1 As Variant, v2 As Variant) As Variant&lt;BR /&gt;
    tl_Nz = v1&lt;BR /&gt;
    If IsNull(v1) Then&lt;BR /&gt;
        tl_Nz = v2&lt;BR /&gt;
    End If&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
When you're reading data out of a recordset in Autocad, you can do this:&lt;BR /&gt;
&lt;BR /&gt;
Dim intVar as integer&lt;BR /&gt;
intvar = tl_Nz(field.value, 0)&lt;BR /&gt;
&lt;BR /&gt;
or&lt;BR /&gt;
&lt;BR /&gt;
Dim strVar as string&lt;BR /&gt;
intvar = tl_Nz(field.value, "")&lt;BR /&gt;
&lt;BR /&gt;
That way you always get a useable value and no "Type Mismatch" or "Invalid &lt;BR /&gt;
Input" errors.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Tony Burba" &lt;TBURBA&gt; wrote in message &lt;BR /&gt;
news:5074161@discussion.autodesk.com...&lt;BR /&gt;
Not sure what you're trying to do.&lt;BR /&gt;
&lt;BR /&gt;
If you're trying to enter null values in the Access field, you should be&lt;BR /&gt;
able to just do&lt;BR /&gt;
&lt;BR /&gt;
field.value = null&lt;BR /&gt;
&lt;BR /&gt;
If you're having trouble dealing with null values coming out of the&lt;BR /&gt;
database, you can do something like&lt;BR /&gt;
&lt;BR /&gt;
        If IsNull(field.value) then&lt;BR /&gt;
            myvar = ""&lt;BR /&gt;
        Else&lt;BR /&gt;
            myvar = field.value&lt;BR /&gt;
        End if&lt;BR /&gt;
&lt;BR /&gt;
Hope this makes sense and that it helps you.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;RAGHUMN&gt; wrote in message news:5074125@discussion.autodesk.com...&lt;BR /&gt;
Hi all,&lt;BR /&gt;
&lt;BR /&gt;
Any idea on coding NULL values in a field of MS Access?&lt;BR /&gt;
Any small part of code or suggestion much appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
MNRaghu&lt;/RAGHUMN&gt;&lt;/TBURBA&gt;</description>
      <pubDate>Wed, 01 Feb 2006 19:01:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545145#M37174</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-02-01T19:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Coding NULL in a field</title>
      <link>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545146#M37175</link>
      <description>The "intVar" in the second example should be "strVar," of course.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Tony Burba" &lt;TBURBA&gt; wrote in message &lt;BR /&gt;
news:5074624@discussion.autodesk.com...&lt;BR /&gt;
To take the latter process one step further:&lt;BR /&gt;
&lt;BR /&gt;
I do a lot of programming involving both Access and AutoCad, so the issue of&lt;BR /&gt;
null fields and their conflict with string variables comes up a lot. There's&lt;BR /&gt;
an Nz function in Access VBA that checks whether a value is null, and if so&lt;BR /&gt;
returns something else that you specify. I wrote a little function in&lt;BR /&gt;
AutoCad VBA to do the same thing, as follows:&lt;BR /&gt;
&lt;BR /&gt;
Public Function tl_Nz(v1 As Variant, v2 As Variant) As Variant&lt;BR /&gt;
    tl_Nz = v1&lt;BR /&gt;
    If IsNull(v1) Then&lt;BR /&gt;
        tl_Nz = v2&lt;BR /&gt;
    End If&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
When you're reading data out of a recordset in Autocad, you can do this:&lt;BR /&gt;
&lt;BR /&gt;
Dim intVar as integer&lt;BR /&gt;
intvar = tl_Nz(field.value, 0)&lt;BR /&gt;
&lt;BR /&gt;
or&lt;BR /&gt;
&lt;BR /&gt;
Dim strVar as string&lt;BR /&gt;
intvar = tl_Nz(field.value, "")&lt;BR /&gt;
&lt;BR /&gt;
That way you always get a useable value and no "Type Mismatch" or "Invalid&lt;BR /&gt;
Input" errors.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Tony Burba" &lt;TBURBA&gt; wrote in message&lt;BR /&gt;
news:5074161@discussion.autodesk.com...&lt;BR /&gt;
Not sure what you're trying to do.&lt;BR /&gt;
&lt;BR /&gt;
If you're trying to enter null values in the Access field, you should be&lt;BR /&gt;
able to just do&lt;BR /&gt;
&lt;BR /&gt;
field.value = null&lt;BR /&gt;
&lt;BR /&gt;
If you're having trouble dealing with null values coming out of the&lt;BR /&gt;
database, you can do something like&lt;BR /&gt;
&lt;BR /&gt;
        If IsNull(field.value) then&lt;BR /&gt;
            myvar = ""&lt;BR /&gt;
        Else&lt;BR /&gt;
            myvar = field.value&lt;BR /&gt;
        End if&lt;BR /&gt;
&lt;BR /&gt;
Hope this makes sense and that it helps you.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;RAGHUMN&gt; wrote in message news:5074125@discussion.autodesk.com...&lt;BR /&gt;
Hi all,&lt;BR /&gt;
&lt;BR /&gt;
Any idea on coding NULL values in a field of MS Access?&lt;BR /&gt;
Any small part of code or suggestion much appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
MNRaghu&lt;/RAGHUMN&gt;&lt;/TBURBA&gt;&lt;/TBURBA&gt;</description>
      <pubDate>Wed, 01 Feb 2006 19:03:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545146#M37175</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-02-01T19:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Coding NULL in a field</title>
      <link>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545147#M37176</link>
      <description>Tony Burba,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the suggestions. That helped me to solve my problem.&lt;BR /&gt;
&lt;BR /&gt;
Bob Coward,&lt;BR /&gt;
Thanks. I should have been more specific too. However, Tony has solved my problem for now.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
MNRaghu</description>
      <pubDate>Thu, 02 Feb 2006 05:09:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545147#M37176</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-02-02T05:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: Coding NULL in a field</title>
      <link>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545148#M37177</link>
      <description>I have found this useful lately.  Assuming oRS is a DAO/ADO recordset.&lt;BR /&gt;
If you are expecting a string:&lt;BR /&gt;
s1 = iif(IsNull(oRS!FieldName), "", oRS!FieldName)&lt;BR /&gt;
If you are expecting a double:&lt;BR /&gt;
d1 = iif(IsNull(oRS!FieldName), 0#, CDbl(oRS!FieldName))&lt;BR /&gt;
-- &lt;BR /&gt;
John Goodfellow&lt;BR /&gt;
irtfnm&lt;BR /&gt;
use john at goodfellowassoc dot com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Tony Burba" &lt;TBURBA&gt; wrote in message&lt;BR /&gt;
news:5074624@discussion.autodesk.com...&lt;BR /&gt;
To take the latter process one step further:&lt;BR /&gt;
&lt;BR /&gt;
I do a lot of programming involving both Access and AutoCad, so the issue of&lt;BR /&gt;
null fields and their conflict with string variables comes up a lot. There's&lt;BR /&gt;
an Nz function in Access VBA that checks whether a value is null, and if so&lt;BR /&gt;
returns something else that you specify. I wrote a little function in&lt;BR /&gt;
AutoCad VBA to do the same thing, as follows:&lt;BR /&gt;
&lt;BR /&gt;
Public Function tl_Nz(v1 As Variant, v2 As Variant) As Variant&lt;BR /&gt;
    tl_Nz = v1&lt;BR /&gt;
    If IsNull(v1) Then&lt;BR /&gt;
        tl_Nz = v2&lt;BR /&gt;
    End If&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
When you're reading data out of a recordset in Autocad, you can do this:&lt;BR /&gt;
&lt;BR /&gt;
Dim intVar as integer&lt;BR /&gt;
intvar = tl_Nz(field.value, 0)&lt;BR /&gt;
&lt;BR /&gt;
or&lt;BR /&gt;
&lt;BR /&gt;
Dim strVar as string&lt;BR /&gt;
intvar = tl_Nz(field.value, "")&lt;BR /&gt;
&lt;BR /&gt;
That way you always get a useable value and no "Type Mismatch" or "Invalid&lt;BR /&gt;
Input" errors.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Tony Burba" &lt;TBURBA&gt; wrote in message&lt;BR /&gt;
news:5074161@discussion.autodesk.com...&lt;BR /&gt;
Not sure what you're trying to do.&lt;BR /&gt;
&lt;BR /&gt;
If you're trying to enter null values in the Access field, you should be&lt;BR /&gt;
able to just do&lt;BR /&gt;
&lt;BR /&gt;
field.value = null&lt;BR /&gt;
&lt;BR /&gt;
If you're having trouble dealing with null values coming out of the&lt;BR /&gt;
database, you can do something like&lt;BR /&gt;
&lt;BR /&gt;
        If IsNull(field.value) then&lt;BR /&gt;
            myvar = ""&lt;BR /&gt;
        Else&lt;BR /&gt;
            myvar = field.value&lt;BR /&gt;
        End if&lt;BR /&gt;
&lt;BR /&gt;
Hope this makes sense and that it helps you.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;RAGHUMN&gt; wrote in message news:5074125@discussion.autodesk.com...&lt;BR /&gt;
Hi all,&lt;BR /&gt;
&lt;BR /&gt;
Any idea on coding NULL values in a field of MS Access?&lt;BR /&gt;
Any small part of code or suggestion much appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
MNRaghu&lt;/RAGHUMN&gt;&lt;/TBURBA&gt;&lt;/TBURBA&gt;</description>
      <pubDate>Thu, 02 Feb 2006 14:24:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545148#M37177</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-02-02T14:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Coding NULL in a field</title>
      <link>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545149#M37178</link>
      <description>John,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the useful information.&lt;BR /&gt;
&lt;BR /&gt;
MNRaghu</description>
      <pubDate>Fri, 03 Feb 2006 02:45:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/coding-null-in-a-field/m-p/1545149#M37178</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-02-03T02:45:47Z</dc:date>
    </item>
  </channel>
</rss>

