Solved

find columns that cannot be NULL

Posted on 2011-03-02
8
231 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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.

758 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

19 Experts available now in Live!

Get 1:1 Help Now