I am using the following to write to a CSV file for use in mail merges, but when there is a NULL value, the CSV file contains #NULL# instead of a sensible NULL indicator, like nothing. How can I replace it with something that MSWord expects as a null entry for a mail merge?
Code:
Open "c:\Address.csv" For Output As #1
Write #1, "First Name", "Last Name", "Company", "Address 1", "Address 2", "Address 3", "Town", "County", "Postcode"
Person.MoveFirst
Comp.MoveFirst
Do While Not Person.EOF
If Not IsNull(Person![AltAdd1]) Then
Write #1, Person![First Name], Person![Last Name], Person![Company], Person![AltAdd1], Person![AltAdd2], Person![AltAdd3], Person![AltTown], Person![AltCty], Person![AltPcd]
Else
Write #1, Person![First Name], Person![Last Name], Comp![Company], Comp![Address 1], Comp![Address 2], Comp![Address 3], Comp![Town], Comp![County], Comp![Postcode]
End If
Person.MoveNext
Comp.MoveNext
Loop
Close #1
Person.Close
Comp.Close
MsgBox "Records exported to C:\Address.CSV"