Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Programming

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 11-20-2008, 11:28 AM
Novice
 
Join Date: Nov 2008
Location: California
Posts: 1
Binky is on a distinguished road
Default Possible to store user-defined types in table?

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.

Thanks,
Binky

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#
rsMe.AddNew
rsMe!TEST_STRUCT = ttMe
rsMe.Update
rsMe.Close
Set rsMe = Nothing
Set dbsMe = Nothing
End Sub
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
New Access User Mermaid Access 0 11-07-2008 11:28 AM
New Database - New User mcarrigg Database Design 1 06-21-2008 02:56 PM
How to store the Field value at query to table?? Maxzs Queries 0 09-25-2006 01:42 AM
Is Access right for what I trying to do? New user. redsled Access 1 08-16-2006 10:44 AM
Count and recount for every new user per day? valkyry Queries 0 07-24-2006 01:37 PM


All times are GMT -8. The time now is 03:02 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.