While adding a table and perspective fields - how does one go about setting the Allow Zero Length property to Yes?
Posted on 2007-07-31
I have the following function that enables me to create a new table based on what name you would like to give it. The problem is when I try to append information - all of the fields have the property - Allow Zero Length as 'No'. How can I change the below to incorporate the property Allow Zero Length as 'Yes'?
Even if I didn't have to change any code below - is there an option under Tools - that allows this to be set to yes?
Private Function Add_Table(sName As String) As Boolean
On Error GoTo Err_This
Dim sSQL As String
If TableExists(sName) = True Then
sSQL = "DROP TABLE [" & sName & "]"
Dim rs As DAO.Recordset
Dim sNewFld As String
Dim dbs As Database
Set dbs = CurrentDb
Dim tdfNew As TableDef
Set tdfNew = dbs.CreateTableDef(sName)
sSQL = "SELECT * FROM tblHorizontal"
Set rs = CurrentDb.OpenRecordset(sSQL)
Do Until rs.EOF
sNewFld = Nz(rs.Fields("fFieldName"), "")
.Fields.Append .CreateField(sNewFld, dbText)
Set rs = Nothing
Set tdfNew = Nothing
Add_Table = True