Form names associated with Class Module (1 Viewer)

Local time
Tomorrow, 05:27
Joined
Sep 14, 2020
Messages
38
Hi,
I am opening a new thread from my initial thread - 319040
@arnelgp guided me towards using a Class Module which I have learning about and implementing.
However, I have an issue with the name of a form which I don't understand and would appreciate further knowledge on what I'm missing?
The example provided by @arnelgp works perfectly. I followed the example implementing it into my home project.
However, I got a Run-time error '2465': Microdsoft Access can't find 'subfrmClientList' referred to in your expression. message.
clsBrowser.init_class Me!subfrmClientList.Form, Me!btnFirst, Me!btnPrevious, Me!btnNext, Me!btnLast
1629001613668.png
1629001234663.png

Form_subfrmClientList is the datagrid as a subform to Form_frmClientBrowser

I could not and still can not see where my problem is so I changed the sample to see what I was doing wrong.

Here is the original - clsNavigate.init_class Me!Customers.Form, Me!btnFirst, Me!btnPrevious, Me!btnNext, Me!btnLast

Take note of the Me!Customers.Form

1629001944991.png
1629002193622.png

I renamed the Forms and ran the project without changing the word "Customers" and the project ran fine.

1629002442551.png
1629002729705.png


I then changed the code Me!Customers.Form to Me!subfrmCustomers.Form which makes logical sense to me and now the project as a Run-time error.

1629003083981.png

I am obviously missing a basic understanding of what's going on and would appreciate any guidance.

Thanking you
Peter
 

Attachments

  • 1629001929564.png
    1629001929564.png
    354.5 KB · Views: 416
  • 1629001997677.png
    1629001997677.png
    15.6 KB · Views: 416

moke123

AWF VIP
Local time
Today, 15:27
Joined
Jan 11, 2013
Messages
3,912
It would be helpful to see the class code.

Are you declaring your subform as a form or subform?
In a class I'm currently working on, heres some partial code (just first lines)

Code:
Private m_objsubCal As Access.SubForm

Sub initSCal(frm As SubForm)

Public Property Get subCal() As Access.SubForm

Public Property Set subCal(ByVal objNewValue As Access.SubForm)


Here's a navbar class I have. Maybe it'll give you some ideas.
 

Attachments

  • NavBarClass_V2.accdb
    580 KB · Views: 421
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:27
Joined
May 7, 2009
Messages
19,229
did you remember if the wizzard put the subform for you?
you may try to make a copy of your db (for safety purpose).
delete the subform and add it again by dragging it
from the navigation pane to the Main form.
 
Local time
Tomorrow, 05:27
Joined
Sep 14, 2020
Messages
38
Thank you @arnelgp and @moke123 for your replies,
@arnelgp, I have done what you suggested and no longer get the Run-time error, however the navigation buttons do not work.
I will spend time checking the code (incl spelling) and see where I have gone wrong.
@moke123, I will review what you have provided to see if I can glean anything from it to help me.
I will reply (with my code - as I suspect I won't find my error) once I have another good look.
Thanking you
Peter
 

Users who are viewing this thread

Top Bottom