Solved

Passing user defined types between modules

Posted on 1998-07-24
2
290 Views
Last Modified: 2010-05-03
Is it possible to pass user defined types between modules? I am receiving the following error message if I pass an instance of my type to a public sub: "User-defined types and fixed-length strings not allowed as the type of a Public member of an object module; Private object modules not allowed as the type of a public member of a public object modules", passing to a private sub in the same module is OK.

0
Comment
Question by:mark_s
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
gissing earned 50 total points
ID: 1466584
If you want to pass a UDT between two modules, the UDT has to be declared as public, so that both modules can see it.
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1466585
Classes can not have methods that have parameters using UDTs... if they are exposed (public).   To combat this, you can do one of 2 things:

1)  Build another class, which just has variables for your type, and pass that

2)  Build a collection to pass back and forth, using the KEY as the name of each variable


Mark's answer is wrong in this case..  He's correct for bas modules.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question