S D
accessd667 at yahoo.com
Wed Mar 10 05:15:17 CST 2004
Hi group,
I need to set the field properties of a lot of tables. I want to do this using VBA.
I was reading Access 2000 Developers Handbook and I found the code printed below. However these are not the properties I expected.
I need to set field properties like:
Fiel Size
Required
Allow Zerow Length
Any idea how I can do this?
TIA
Sander
Private Sub Command0_Click()
Dim db As DAO.Database
Dim intI As Integer
Dim tdf As DAO.TableDef
Set db = CurrentDb()
For intI = 0 To db.TableDefs.Count - 1
Set tdf = db.TableDefs(intI)
If tdf.Name = "V3_44_RSDTD1" Then
Debug.Print "Printing properties for table: " & tdf.Name
Call ListTableProps(tdf.Name)
MsgBox "Properties listed!"
End If
Next intI
MsgBox "Done! Tables found: " & intI
End Sub
Sub ListTableProps(strTable As String)
Dim db As Database
Dim tdf As TableDef
Dim prp As DAO.Property
Set db = CurrentDb()
Set tdf = db(strTable)
For Each prp In tdf.Properties
Debug.Print prp.Name, prp.Type, prp.Value
Next prp
End Sub
---------------------------------
Do you Yahoo!?
Yahoo! Search - Find what youre looking for faster.