[AccessD] use of Public Type in Collections

Lembit Soobik lembit.dbamail at t-online.de
Fri Jan 25 06:05:35 CST 2008


Hello All,

with the following code in Access 2002 I get a compile error that 
reads(translated from German):

Only user-defined types, which are defined in public Object-Modules, may be 
converted to or from type Variant
or passed to a function which is resolvable at runtime.

---------------start code-----------------------------
Option Compare Database
Option Explicit

Public Type Verzeichnis
    VzID As Long
    VzPfad As String
    VzParent As Long
End Type

Public Function testCollect() As Boolean
    Dim ColPath As New Collection
    Dim dirPath As Verzeichnis
    With dirPath
        .VzID = 1
        .VzPfad = "J:\"
        .VzParent = 0
    End With
    ColPath.Add (dirPath)<-------------------------Error: dirPath is marked

-----------------------------------------------------------

This code is in a module, not behind a form. Do I have to make this module 
public? if so, how?

thank you

Lembit




More information about the AccessD mailing list