Testing classes without needing a Form

mdlueck

Sr. Application Developer
Local time
Today, 19:50
Joined
Jun 23, 2011
Messages
2,633
As projects grow and grow, I am ever less patient to be able to test "something" without fully developing.

Using the VBA Immediate window (VBA Editor, Ctrl-G) I found if the right needed objects are in memory, I am able to test a new class WITHOUT needing to build the form which the class is to work with! :p

Steps I performed:
1) Write the VBA class
2) Provide the supporting code which creates an instance of the class. I create all of my DB class objects in separate Modules per chunk of the application. So this time I went to module "modbuyer_bootstrap" and added this LOC:
Code:
Public ObjBuyerOMTbl As New clsObjBuyerOMTbl
3) Then I got far enough into the application that I knew all of the other DB objects ObjBuyerOMTbl would need were created and populated with valid data.
4) Lastly, moment of truth, I triggered a method of the class object via the Immediate window:
Code:
? ObjBuyerOMTbl.RefreshLocalTmpTbl
pressed Enter and then saw:

Code:
? ObjBuyerOMTbl.RefreshLocalTmpTbl
True
as that class method returns a Logical. Checking the FE Temp Table indeed I see the correct records! :D

Now I have already tested the DB class object which will populate the form with data. I may shift from VBA class thinking to form thinking. Perhaps "Access/VBA gone Agile?" WFM. YMMV. EIEIO.
 

Users who are viewing this thread

Back
Top Bottom