SAC,
Earlier, you wrote:
"Also, I just realized that I didn't have the dao object library in the references, so I added
the MS DAO 3.51 Object Library...."
This implies that you are using Access 97. Although you can include the ADO library as a checked
reference in Access 97, ADO was first introduced as a data access method in Access 2000. If you
are using Access 2000 or higher, you should have added a checked reference to the Microsoft DAO
3.6 Object Library instead of the 3.51 library.
Here is a link that you may want to read that provides more detail on disambiguating your code to
avoid reference priority issues:
http://www.access.qbuilt.com/html/gem_tips1.html
Tom
__________________________________
Change this line of code:
From:
Dim db As Database, td As TableDef, fld As Field
To:
Dim db As DAO.Database, td As DAO.TableDef, fld As DAO.Field
Actually, the DAO in front of the Database is not required, but it helps to clarify your
intentions that you are using DAO code. You are getting this error because you have the priority
of the ADO library higher in the list than the DAO library. By explicitly declaring your objects,
you prevent this type of Snafu.
As for documenting your code, I recommend including the title and URL as comments in procedures
that you find on the internet. At least that way you have some traceability as to the source of
the code.
Tom
________________________________
Now I get an error:
Compile error.
Member or data member not found.
What do I need to change?
Thanks.
________________________________
SAC,
Not sure where you found your code--it is always helpful to provide a link to your source so that
other's may find it easily. Try the sample found here:
ACC: How to Set AllowZeroLength Property to Yes in All Tables
http://support.microsoft.com/?id=130336
Tom
_________________________________
Also, I just realized that I didn't have the dao object library in the
references, so I added the MS DAO 3.51 Object Library and now I get:
Run-time error '424':
Object required
Thanks again
_________________________________
Was db properly instantiated before you tried to use it in your call to the sub?
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
_________________________________
I need to change the allow zero length property on the fields in a table. I found this in the ms
knowledgebase, but I don't know how to write the syntax to run it in the intermediate window:
Sub FixAllowZeroLength(td As TableDef)
Dim F As Field
For Each F In td.Fields
If F.Type = dbText Or F.Type = dbMemo Then
F.AllowZeroLength = -1 ' reasserting the default value
End If
Next F
End Sub
I tried FixAllowZeroLength db!tblPeople, but it's the wrong syntax.
What's the right syntax?
Thanks.