Solved

find columns that cannot be NULL

Posted on 2011-03-02
8
236 Views
Last Modified: 2012-05-11
is there a query that can check which all columns in tables that are designed to be not nullable.

thanks
0
Comment
Question by:anushahanna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 15

Accepted Solution

by:
cquinn earned 200 total points
ID: 35015771
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
0
 
LVL 4

Assisted Solution

by:MarioAlcaide
MarioAlcaide earned 100 total points
ID: 35015782
I don't think it can be done in Access with a query, it could be done if you use Oracle for example
0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 200 total points
ID: 35015842
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)
Else
testreq = reqlist
End If
End Function

Sub testfn()
MsgBox testreq("products")
End Sub
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Author Comment

by:anushahanna
ID: 35015868
where can i find the Database documentor tool (in Design?)
0
 
LVL 6

Author Comment

by:anushahanna
ID: 35015869
peter, how can you run the vba as a standalone (like a query) without a click event?
0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 200 total points
ID: 35016059
Just change the table name in my testfn() and run that sub.
0
 
LVL 15

Assisted Solution

by:cquinn
cquinn earned 200 total points
ID: 35016190
The database documenter is in the Database Tools tab on the main menu bar
0
 
LVL 6

Author Comment

by:anushahanna
ID: 35150218
thanks all!
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question