Applies To Database object.
Description
Indicates whether zero-length strings (" ") used in code to fill Text or Memo fields are converted to Null.
Settings and Return Values The setting or return value is a Boolean that is True if zero-length strings are converted to Null. Remarks This property applies to Microsoft Jet database engine version 1.x databases that have been converted to Microsoft Jet database engine version 2.0 or 3.0 databases. Note The Microsoft Jet database engine automatically creates this property when it converts a version 1.x database to a version 2.0 or 3.x database. A 2.0 database will retain this property when it is converted to a 3.x database. If you change this property setting, you must close and then reopen the database for your change to take effect. For fastest performance, modify code that sets any Text or Memo fields to zero-length strings so that the fields are set to Null instead, and remove the V1xNullBehavior property from the Properties collection.See Also Index property.
Example This example converts a Microsoft Jet version 1.1 database file to a Microsoft Jet version 3.0 database file. During conversion, the V1xNullBehavior property is created and added to the Properties collection of the new database. The Properties collections of both database files are enumerated to show the change. Finally, the V1xNullBehavior property is deleted. This assumes that any applications will be modified to store Null values in empty Text and Memo fields rather than empty strings. Note Unless you can obtain a Microsoft Jet version 1.1 file called "Nwind11.mdb," this procedure will not run.Sub V1xNullBehaviorX()
Dim dbsNorthwind As Database
Dim prpLoop As Property
Set dbsNorthwind = OpenDatabase("Nwind11.mdb")
With dbsNorthwind
Debug.Print .Name & ", version " & .Version
' Enumerate Properties collection of Northwind
' database.
For Each prpLoop In .Properties
On Error Resume Next
If prpLoop <> "" Then Debug.Print " " & _
prpLoop.Name & " = " & prpLoop
On Error GoTo 0
Next prpLoop
.Close
End With
DBEngine.CompactDatabase "Nwind11.mdb", _
"Nwind30.mdb", , dbVersion30
Set dbsNorthwind = OpenDatabase("Nwind30.mdb")
With dbsNorthwind
Debug.Print .Name & ", version " & .Version
' Enumerate Properties collection of compacted
' database. The V1xNullBehavior property cannot be
' referred to explicitly, that is,
' dbsNorthwind.V1xNullBehavior, but it can be accessed
' in loops or by string reference, that is,
' dbsNorthwind.Properties("V1xNullBehavior").
For Each prpLoop In .Properties
On Error Resume Next
If prpLoop <> "" Then Debug.Print " " & _
prpLoop.Name & " = " & prpLoop
On Error GoTo 0
Next prpLoop
.Properties.Delete "V1xNullBehavior"
.Close
End With
End Sub