Access 2016 - Private Type no longer working

jessss

Registered User.
Local time
Today, 09:27
Joined
Jan 17, 2010
Messages
29
Hi, I am trying to upgrade my Access database system to 2016 and so far it is OK however the code below is no longer working and keeps producing the error "Private Enum and user defined types cannot be used as parameters or return types for public procedures, public data members, or fields of public user defined types"

"Private Type PostcodeData
Lookup As String * 60
Postcode As String * 8
postcodeType As String * 2
Organisation As String * 30
Property As String * 30
Street As String * 60
Locality As String * 60
Town As String * 30
County As String * 30
ctyOption As String * 1
mailsort As String * 5
STD As String * 8
gridN As String * 6
gridE As String * 5
CensusCode As String * 4
Affluence As String * 30
LifeStage As String * 100
AdditionalCensusInfo As String * 200
Occupancy As String * 1
AddressType As String * 1
Reserved As String * 48
End Type

Private Declare Function GetFirst Lib "PCode32.DLL" (details As PostcodeData, reverse As Integer) As Long
Private Declare Function GetNext Lib "PCode32.DLL" (details As PostcodeData) As Long"

The code above is used by Private subs and Private functions. I have tried changing them to public but it said produced the error.

Does anyone know why this code no longer works in Access 2016?

Thanks.:):confused:
 
I did encounter that.
What i did is i turned it into a class. Create a PostCodeData class and declare your variables as public.

You need to instantiate the class before you can use it.

Dim clspcode as PostCodeData

Set clspcode=new PostCodeData


'****
' insert in class module
"Private Type PostcodeData
Public Lookup As String * 60
Public Postcode As String * 8
Public postcodeType As String * 2
Public Organisation As String * 30
Public Property As String * 30
Public Street As String * 60
Public Locality As String * 60
Public Town As String * 30
Public County As String * 30
Public ctyOption As String * 1
Public mailsort As String * 5
Public STD As String * 8
Public gridN As String * 6
Public gridE As String * 5
Public CensusCode As String * 4
Public Affluence As String * 30
Public LifeStage As String * 100
Public AdditionalCensusInfo As String * 200
Public Occupancy As String * 1
Public AddressType As String * 1
Public Reserved As String * 48
''End Type
 
Try decompiling your database. It should fix the problem.
 

Users who are viewing this thread

Back
Top Bottom