Solved List of methods of a class in intellisense

KitaYama

Well-known member
Local time
Today, 21:32
Joined
Jan 6, 2022
Messages
1,885
I have a form with several public methods.

Code:
Private m_PK As Long

Public Property Get PK() As Long
    PK = m_PK
End Property

Public Property Let PK(ByVal NewValue As Long)
    m_PK = NewValue
End Property

When I open the form as following, intellisense doesn't show the list of methods.

Code:
    DoCmd.OpenForm "frm"
    With Forms("frm")
        .
    End With

But if I add a class module and do the same, after instantiating the class, I have the list of all methods in inellisense.

Isn't a form module just like a class module? Shouldn't both behave the same?
Or am I missing some steps here?

Thanks for any kind of guidance/advice.
 
Solution
You need to subclass the form. Declare it as a specific form not a general form.

Code:
Dim frm as Form_YourFormName
docmd.openForm "yourFormName"
set frm = forms("YourFormName")
frm. intellisense for all properties, methods here.
"special additions"
I meant all methods and properties added to the class Form_Frm.

[OT: public / friend]
Not quite correct, but easy to remember described: Friend is Public inside the current VBProject and Private outside.
All Codemodules inside a VBProject are friends - therefore they are allowed to use the methods/properties declared as (only for) Friend. ;)
@Josef P. I read several articles and I think I know a better idea of what Friend is all about.
To be honest, the articles couldn't help much if it wasn't for the way you showed it in your sample databases in #18.

I really can't find the correct words to thank you for your time and help.
Much appreciated.
 

Users who are viewing this thread

Back
Top Bottom