Solved

find columns that cannot be NULL

Posted on 2011-03-02
8
232 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
  • 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
 
LVL 6

Author Comment

by:anushahanna
ID: 35015868
where can i find the Database documentor tool (in Design?)
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now