find columns that cannot be NULL

is there a query that can check which all columns in tables that are designed to be not nullable.

Who is Participating?
cquinnConnect With a Mentor Commented:
I don't know how to do it in a query, but the Database documentor tool (on the database tools tab) will show this information
MarioAlcaideConnect With a Mentor Commented:
I don't think it can be done in Access with a query, it could be done if you use Oracle for example
peter57rConnect With a Mentor Commented:
Can't be done in sql.

You can use a vba function...

Function testreq(tbl As String) As String
Dim reqlist As String
Dim db As Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Set db = CurrentDb
Set tdf = db.TableDefs(tbl)
For Each fld In tdf.Fields
If fld.Required = True Then reqlist = reqlist & fld.Name & ","
Next fld

Set tdf = Nothing
Set db = Nothing
If Len(reqlist) > 1 Then
testreq = Left(reqlist, Len(reqlist) - 1)
testreq = reqlist
End If
End Function

Sub testfn()
MsgBox testreq("products")
End Sub
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

anushahannaAuthor Commented:
where can i find the Database documentor tool (in Design?)
anushahannaAuthor Commented:
peter, how can you run the vba as a standalone (like a query) without a click event?
peter57rConnect With a Mentor Commented:
Just change the table name in my testfn() and run that sub.
cquinnConnect With a Mentor Commented:
The database documenter is in the Database Tools tab on the main menu bar
anushahannaAuthor Commented:
thanks all!
All Courses

From novice to tech pro — start learning today.