Hi,

I have used the following code to add a new field to a database. Is there a way to stop this field having a Null value but still keep it empty?

strSQL = "SELECT * FROM cells ORDER BY cell, Proof;"
    Set db = OpenDatabase(lblDatabase.Caption, False, False)


       Set tbl = db.TableDefs("cells")

        ' Create and append new Field objects
        tbl.Fields.Append tbl.CreateField("Extra", dbText, 20)

u can't use both stop entering null value into a field and allow it to keep empty together.instead of u can restrict the user not to enter any blank value to the field.in this case u'll need to check the field whether its current value is blank or not before trying to save it to the database.just fire a lostfocus event of the control in which u are entering the data to check whether the control has some data or not.if yes then save it to the database otherwise throw a msg to the user.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.