Sorry,刚才按错了。 if isnull(rsX!Field1) then msgbox "This is null!" end if 如果你要在SQL语句中判断是否为空的话,用 Select * From Table1 Where Field1 is not null
对了 rsX!Field1是什么意思
'引用 ADO: Microsoft ActiveX Data Objects 2.6 Library '引用 ADOX: Microsoft ADO Ext. 2.6 for DDL ans Security Dim adoConnection As New ADODB.Connection Dim CatalogX As New ADOX.Catalog adoConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data\NWind97.mdb;Persist Security Info=False" Set CatalogX.ActiveConnection = adoConnection Dim i As Integer Dim j As Integer For i = 0 To CatalogX.Tables.Count - 1 If CatalogX.Tables.Item(i).Type = "TABLE" Then For j = 0 To CatalogX.Tables.Item(i).Columns.Count - 1 Debug.Print "[" & CatalogX.Tables.Item(i).Name & "].[" & CatalogX.Tables.Item(i).Columns.Item(j).Name & "]" & VBA.IIf(CatalogX.Tables.Item(i).Columns.Item(j).Attributes <> adColNullable, " Not ", " ") & "Allow Null!" Next j End If Next i
if isnull(rsX!Field1) then
msgbox "This is null!"
end if
如果你要在SQL语句中判断是否为空的话,用
Select * From Table1 Where Field1 is not null
rsX!Field1是什么意思
'引用 ADOX: Microsoft ADO Ext. 2.6 for DDL ans Security
Dim adoConnection As New ADODB.Connection
Dim CatalogX As New ADOX.Catalog
adoConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data\NWind97.mdb;Persist Security Info=False"
Set CatalogX.ActiveConnection = adoConnection
Dim i As Integer
Dim j As Integer
For i = 0 To CatalogX.Tables.Count - 1
If CatalogX.Tables.Item(i).Type = "TABLE" Then
For j = 0 To CatalogX.Tables.Item(i).Columns.Count - 1
Debug.Print "[" & CatalogX.Tables.Item(i).Name & "].[" & CatalogX.Tables.Item(i).Columns.Item(j).Name & "]" & VBA.IIf(CatalogX.Tables.Item(i).Columns.Item(j).Attributes <> adColNullable, " Not ", " ") & "Allow Null!"
Next j
End If
Next i