ACC2: Setting a Database's V1xNullBehavior Property (114548)



The information in this article applies to:

  • Microsoft Access 2.0

This article was previously published under Q114548

SUMMARY

In Microsoft Access version 2.0, the behavior of Null and zero-length strings differs from that in Microsoft Access version 1.x. Microsoft Access version 2.0 can distinguish between Null and zero-length strings, whereas Microsoft Access version 1.x cannot.

Because of this, Microsoft Access version 2.0 has a new property called V1xNullBehavior that you can use to cause Microsoft Access to convert zero- length strings to Null. This property applies only to version 1.x databases that have been converted to version 2.0. When you convert a database from version 1.x to version 2.0, the V1xNullBehavior property is automatically created.

MORE INFORMATION

The V1xNullBehavior property triggers these behaviors:
  • Assignments in Access Basic to DAO field objects is implicitly converted from zero-length strings to Null if the field does not support zero-length strings.
  • The SetValue action has similar mappings.
It is important to set the V1xNullBehavior property to the setting you want. Do not set the property if you do not fully understand the ramifications of setting it.

You can set the V1xNullBehavior property on an existing database using the following code in the database that you want to change:
   Sub SetV1XNullBehavior ()
     Dim db As Database, prop As Property
     Set db = DBEngine.Workspaces(0).Databases(0)
     Set prop = db.CreateProperty("V1xNullBehavior", DB_INTEGER)
     prop.Value = True
     db.properties.Append prop
     db.Close
   End Sub
				

REFERENCES

For more information about the V1xNullBehavior property, search for "V1xNullBehavior" then "V1xNullBehavior Property" using the Microsoft Access Help menu.

Microsoft Access "Building Applications," Appendix C, "Conversion Issues and New Features for Access Basic"

Microsoft Access "Building Applications," Chapter 7

Modification Type:MajorLast Reviewed:11/6/2000
Keywords:kbinfo kbprogramming KB114548