CreateField error

  • Thread starter Thread starter Max
  • Start date Start date
M

Max

Hi,
I am using Access97 on Windows XP desktop and the following references:
Visual basic VBA322.DLL
Access 8.0 Object Library
Common controls 6.0
Word 10.0
DAO 2.5/3.5

The following code generates a "Method or data member not found" error on
the CreateField.

Set tdf = dbs.TableDefs!Patients
Set idx = tdf.CreateIndex("PatientIDIndex")
Set fld1 = idx.CreateField("OpNoteID")

Any ideas?

Thanks in advance,
Max
 
The error would normally indicate that the field name does not exist, e.g.
is misspelled.

Or possibly you need to disambiguate the Field declaration, i.e.:
Dim fld1 As DAO.Field

Alternative syntax to try:
inx.Fields.Append inx.CreateField("OpNoteID")
 
Hi Allen,

I used Dim fld1 As DAO.Field but still got the same error.
The declarations are:
Dim dbsLogdat As Database, tdf As TableDef, idx As Index, fld1 As DAO.Field


Max
 
ADO and ADOX have an Index as well.

Try:
Dim dbsLogdat As Database, tdf As DAO.TableDef, idx As DAO.Index, fld1 As
DAO.Field
 
Thanks Allen,
That helped with this bit code.
Now other errors have come up that were not previously a problem. I suspect
I have a references problem.
Running through Doug Steele's very helpful pages.

Max
 
Back
Top