matrixindicator
IS-IT--Management
I need to replace an empty string "" to a null (IsNull) value in a table.
First I need to dedect an invisible empty string. How can I set an empty string for test and is this the best way to detect Nz(rst(x).Value, "") = "" an empty string ?
First I need to dedect an invisible empty string. How can I set an empty string for test and is this the best way to detect Nz(rst(x).Value, "") = "" an empty string ?
Code:
Public Sub StringIsNull()
Dim dbs As DAO.Database
Dim tdf As TableDef
Dim fld As Field
Dim x As Integer
Dim y As Integer
Dim rst As DAO.Recordset
y = 0
Set dbs = CurrentDb
Set tdf = dbs.TableDefs("T01")
Set rst = dbs.OpenRecordset("T01", dbOpenDynaset)
rst.MoveFirst
For x = 0 To tdf.Fields.Count - 1
Do While Not rst.EOF
If Nz(rst(x).Value, "") = "" Then
y = y + 1
End If
rst.MoveNext
Loop
Next x