Hi folks,

Running Access 2003

I'm trying to figure out a way to define a data type (consisting of several elements) and to then store/retrieve this data type in a field of a table. I've tried Memo and OLE Object field types. The code fragment below generates the following error message:

Compile Error. Only user-defined types defined in public object models can be coerced to or from a variant or passed to late-bound functions.

I've also (so far) been unable to figure out what a "public object model" is, or how to define one. Is it even possible to store user-defined data types in Access 2003? Any insight on this would be appreciated.


Code fragment:

Option Compare Database
Option Explicit
Public Type Test_type
strTest1 As String
lngTest2 As Long
strTest3 As String
dtTest4 As Date
strTest5 As String
End Type

Public Sub testit1()
Dim dbsMe As Database
Dim rsMe As Recordset
Dim ttMe As Test_type
Set dbsMe = CurrentDb
Set rsMe = dbsMe.OpenRecordset("tblTEST1")
ttMe.strTest1 = "Beginning..."
ttMe.dtTest4 = #1/1/2007#
Set rsMe = Nothing
Set dbsMe = Nothing
End Sub