Wrapping controls WithEvents in classes

OK great, I thought I had lost you. Can you do me a favor and mention the section / subsection when you point out an issue. Pages can and do change. Just something like clsFrm-Building a ctl scanner.

Anyway, yes the with "fixes" the dot issue but I think that actually specifying ctl.name etc is a better choice. I flip back and forth in the database which may be confusing to some readers?

Case acComboBox
If ctl.Name = "cboRecSel" Then

rather than

Case acComboBox
If .Name = "cboRecSel" Then

If you don't have an issue with this I am going to standardize on that. As such I am going to remove the With Ctl wrapper.
 
Am I correct in thinking the latest versions are available at these links?

If not, where?

Screenshot 2025-05-26 081015.jpg
 
John,
FrmDateRange will not compile.
Code:
Set fclsDateRange = cDteRange()

cDteRange does not exist as of yet. It can be found in basInitClasses in your DB.?
ALso why is frmDateRange opening two non existent forms?
1748266318690.png
 
John,
FrmDateRange will not compile.
Code:
Set fclsDateRange = cDteRange()

cDteRange does not exist?
ALso why is frmDateRange opening two non existent forms?
View attachment 119946
LOL because ... well... because I did not tell you to build them. I am getting to the point where I need to do something about forms. Writing about designing forms is a royal pita. So many properties, so many controls etc. Your thoughts on this?

All this stuff exists in EventDrivenProgrammingInVBADemoDB.ACCDB. So the question is whether you think I should point the reader to the demo database? That is after all why it exists.

After that should I tell them to import it into the db they have been building? Or just phase out the "build your own" drama? The nice thing about the "build your own" drama is that the reader is creating a database that they are familiar with and can use in the future as the basis for their own explorations. Your thoughts on this?
 
Yes, I would go with 'build your own'.
That is how I am approaching it, and trying to understand how it all fits together.

Just importing your classes, I do not think is going to help a developer?
To my mind it is like using a template. Yes, you have a ready made DB to start with, but no clue how it is put together, so have to explore all this new code. If one builds their own DB, they slowly get to know the code and the logic.

Never mind the forms for now, I see them in your DB, but the cDateRange() has never been mentioned?
Surely you need to mention functions like these, before you try and use them?

So perhaps in this case after all the code for the Date form is created, you mention that one now needs to add cDateRange to a particular class module?

I came upon a DB today, that I thought instantly, could use a class for the tabs when I saw all the duplicated code for the alphabet and the # character.
I managed it, by just creating a sub and calling that, but realise a class would be better.

 
I just searched my doc and am not finding cDateRange mentioned anywhere. It is a class out in the db database
 
Look at the frmDateRange form. In the Initialization section.
Currently on page 126.
Sorry it is cDteRange. See pic in post 109. In fact I got the name correct. :)
 
Am I correct in thinking the latest versions are available at these links?

If not, where?

View attachment 119944
Further to moke's comment, are we to expect all latest changes to the evolving book and the database to be at the links he quoted? I know John said he is pushing stuff to github and is trying to keep the book and database in sync - but that's considerable "syncing". I hope there is an effective backup process.
 
Look at the frmDateRange form. In the Initialization section.
Currently on page 126.
Sorry it is cDteRange. See pic in post 109. In fact I got the name correct. :)
OK I replaced clsDteRange with clsCtlDateRange, which is what it is in my demodb. 22 places it was replaced. :oops:
19 places replaced in the demodb.:eek:
 
I am trying to use a naming convention

cls(Ctl)XXX if it deals with controls, where XXX is the ControlType.
 
I am trying to use a naming convention

cls(Ctl)XXX if it deals with controls, where XXX is the ControlType.
The XXX being the control type isn't always possible because a class can wrap several controls if the class deals with a system.

As for the two forms not found, this demo (see the demo out in the demo database) demonstrates the main form creating the date range, then raising an event which can be sunk by a different form. Or two different forms in this case.

It feels like you are resisting looking at the demo db. One of the things I feel is important is to show the reader actual examples of events (as I use them) at work in the real world. OK the demo world. The demo database allows me to get some things demonstrated which are not (yet) in the book at all.
 
Further to moke's comment, are we to expect all latest changes to the evolving book and the database to be at the links he quoted? I know John said he is pushing stuff to github and is trying to keep the book and database in sync - but that's considerable "syncing". I hope there is an effective backup process.
ROTFL. That is considerable syncing. Because of the immediate and changing nature of the book and the database as @Gasman finds and I fix things, by pushing to GitHub those changes are "live" out on Github, and yes those links point directly to the files.

And I thought GitHub was my backup. I have a copy of the project in the repository on my computer, and a copy in GitHub. I have a private repository where I keep the LibreOffice book itself. I only back it up once a day or so. I should do it more often (every change?) but this is already a ton of work.
 
Further to moke's comment, are we to expect all latest changes to the evolving book and the database to be at the links he quoted? I know John said he is pushing stuff to github and is trying to keep the book and database in sync - but that's considerable "syncing". I hope there is an effective backup process.
Are you actually following all this stuff?
 

Users who are viewing this thread

Back
Top Bottom