H
hydroparadise
Hey guys, first time posting. I can't figure out why I keep getting a "Type
Mismatch" Error when passing a DAO.Tabledef object into a user defined class
function. Check out the impelementation...
<class module start: FieldCategories>
Option Compare Database
Option Explicit
Public Function GetFields(td As DAO.TableDef)
Msgbox td.Fields.Count
End Function
<class module end>
Dim field1 as FieldCategories
Set field1 = New FieldCategories
Dim td1 as DAO.TableDef
'Usualy write out entire path for best practice
Set td1 = DBEngine.Workpsaces(0).Databases(0).TableDefs("Table1")
td1.GetFields(td1) '<<Gets "Type Mismatch" Error
Not sure what im doing wrong. Maybe its something stupid. I hope so!
Mismatch" Error when passing a DAO.Tabledef object into a user defined class
function. Check out the impelementation...
<class module start: FieldCategories>
Option Compare Database
Option Explicit
Public Function GetFields(td As DAO.TableDef)
Msgbox td.Fields.Count
End Function
<class module end>
Dim field1 as FieldCategories
Set field1 = New FieldCategories
Dim td1 as DAO.TableDef
'Usualy write out entire path for best practice
Set td1 = DBEngine.Workpsaces(0).Databases(0).TableDefs("Table1")
td1.GetFields(td1) '<<Gets "Type Mismatch" Error
Not sure what im doing wrong. Maybe its something stupid. I hope so!