By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

AXP and Implements

P: n/a
I was trying to use interfaces in Access XP, following the only page available
in VBA help, the one relative to Implements keyword.

Here are the class modules I prepared:

1) clsPersonalData
==========================
Option Compare Database
Option Explicit

Public Name As String
Public Address As String
==========================

2) clsCustomer
==========================
Option Compare Database
Option Explicit

Implements clsPersonalData

Private Property Get PersonalData_Address() As String
PersonalData_Address = "CustomerAddress"
End Property

Private Property Let PersonalData_Address(ByVal RHS As String)
'
End Property

Private Property Let PersonalData_Name(ByVal RHS As String)
'
End Property

Private Property Get PersonalData_Name() As String
PersonalData_Name = "CustomerName"
End Property
==========================

Unfortunately, while compiling I get the following error in clsCustomer class,
at the line with the Implements instruction:
"Object module must implement 'Name' form interface 'clsPersonalData'"

I searched a lot with Google but found noone using interfaces in Access.

May you suggest me?

--
PBsoft di Gabriele Bertolucci
www.pbsoft.it
skype: pbsoftsolution
Apr 26 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"PBsoft" <in**@REMOVEpbsoft.it> wrote in message
news:87**************************@news.tin.it...
I was trying to use interfaces in Access XP, following the only page
available in VBA help, the one relative to Implements keyword.

Here are the class modules I prepared:

1) clsPersonalData
==========================
Option Compare Database
Option Explicit

Public Name As String
Public Address As String
==========================

2) clsCustomer
==========================
Option Compare Database
Option Explicit

Implements clsPersonalData

Private Property Get PersonalData_Address() As String
PersonalData_Address = "CustomerAddress"
End Property

Private Property Let PersonalData_Address(ByVal RHS As String)
'
End Property

Private Property Let PersonalData_Name(ByVal RHS As String)
'
End Property

Private Property Get PersonalData_Name() As String
PersonalData_Name = "CustomerName"
End Property
==========================

Unfortunately, while compiling I get the following error in clsCustomer
class, at the line with the Implements instruction:
"Object module must implement 'Name' form interface 'clsPersonalData'"

I searched a lot with Google but found noone using interfaces in Access.

May you suggest me?

--
PBsoft di Gabriele Bertolucci
www.pbsoft.it
skype: pbsoftsolution



I can't see exactly what you are trying to achieve, but it looks vaguely
like you are trying to create a Customer object based on a Person object -
although I wouldn't use your convention to name my classes.
Perhaps this example will help:

' ----------------------------------------
' Saved in a class module named Person
Option Compare Database
Option Explicit

Public Property Get FirstName() As String
End Property

Public Property Let FirstName(strFirstName As String)
End Property
' ----------------------------------------


' ----------------------------------------
' Saved in a class module named Customer
Option Compare Database
Option Explicit

Implements Person

Private m_strFirstName As String

Private Property Let Person_FirstName(RHS As String)
m_strFirstName = RHS
End Property

Private Property Get Person_FirstName() As String
Person_FirstName = m_strFirstName
End Property
' ----------------------------------------

' ----------------------------------------
' Saved in a form module named frmTestMe
Private Sub cmdTest_Click()

' Test my classes:
Dim x As Person

Set x = New Customer

x.FirstName = "Peter"

MsgBox "I am a customer." & vbCrLf & _
"I am a type of person." & vbCrLf & _
"My name is " & x.FirstName & ".", _
vbInformation, "Hello"

Set x = Nothing

End Sub
' ----------------------------------------



Apr 26 '06 #2

P: n/a
I appreciated your help.

Thanks.

--
PBsoft di Gabriele Bertolucci
www.pbsoft.it
skype: pbsoftsolution
Apr 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.