DefaultValue option

  • Thread starter Thread starter Gilbert R Ramirez
  • Start date Start date
G

Gilbert R Ramirez

When I write the command

'-----------------------
Dim db As Database
Dim tbl As TableDef
Dim f1 As Field, f2 As Field
Set db = CurrentDb
Set tbl = db.CreateTableDef(NewName)
Set f1 = tbl.CreateField("record", dbLong)
Set f2 = tbl.CreateField("PC", dbLong)

"f2.DefaultValue = 7"
'-----------------------

DefaultValue is not showing up in the drop down options.

I'm getting a "compile error: Method or data member not
found"

and Available References that are checked off:
Visual Basic for Applications
Microsoft Access 9.0 Odject Library
OLE Automation
Microsoft ActiceX Data Odjects 2.1 Library
Microsoft DAO 3.6 Odject Library

I've used this code before and I know it works
on MS Access 97 version... now what about 2000?

Please help, Thanks.
Gil
 
Try Dimming all of your DAO objects with the DAO. qualifier; i.e.,

Dim db as DAO.Database
dim tbl as DAO.TableDef
dim f1 as DAO.Field

or,

If your database application does not use ADO objects, you can remove the
reference to ActiveX Data Objects, or move your reference to DAO 3.6 above
the ADO reference.
 
Thanks, for the help.

I moved the DAO 3.6 above the ADO (ActiveX Data Objects)
2.1 reference and now it works great. Thanks again.
-Gil
 
Back
Top