D
Damien
First of all, you are best off using DAO to interact with
your Access database's own objects, like its tables,
queries and fields. DAO is still the fastest way to
access a Jet database, apparently.
So, make sure your reference is set for DAO, then try:
Sub subChangeFields()
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Set dbs = CurrentDb
Set tdf = dbs.TableDefs("table1")
For Each fld In tdf.Fields
fld.Required = False
Next
Set dbs = Nothing
End Sub
You'll be able to customise it to do what you want right ?
Let me know how you get on.
Damien
a way to do this without having to resort to ADO, DAO, or
SQL. I mean, Excel's object model includes the application
itself, file, sheet, range, etc.
SQL) to change all fields in a table to accept nulls (i.e.
Required = No)?
your Access database's own objects, like its tables,
queries and fields. DAO is still the fastest way to
access a Jet database, apparently.
So, make sure your reference is set for DAO, then try:
Sub subChangeFields()
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Set dbs = CurrentDb
Set tdf = dbs.TableDefs("table1")
For Each fld In tdf.Fields
fld.Required = False
Next
Set dbs = Nothing
End Sub
You'll be able to customise it to do what you want right ?
Let me know how you get on.
Damien
using conventional VBA? It seems as though there should be-----Original Message-----
Hello. I'm using VBA in Access XP with Win 2K.
1. Is there a way to loop through the fields in a table
a way to do this without having to resort to ADO, DAO, or
SQL. I mean, Excel's object model includes the application
itself, file, sheet, range, etc.
this, preferably using VBA, (but if necessary using ADO or2. Could someone please post example code on how to do
SQL) to change all fields in a table to accept nulls (i.e.
Required = No)?