Hello gmr4evr1 and thank you for your reply.
This UserForm is a custom control that you can put on worksheet or on excel userform.
I call it Virtual form because it does not exist in design time but it is created on runtime.
Each Userform (or as I call it Virtual form) consists from 3 main elements:
Grid, Edit and Buttons control.
In order to know how and what to create, virtual forms engine needs to have definitions (that are stored in a file and created by Virtual form Designer).
In this Designer:
First we define Virtual Form name, description and the table (or worksheet) from where this Virtual Form gets and manipulate data (for now it supports Access, Excel, MySQL and MS SQL).
Then we define a Grid and Edit control and the fields (from table or worksheet) that will be in this controls.
And then we define what buttons we want to use on this Virtual form (Refresh, Filter, New, Edit, Delete, Exit,...., there are predefined buttons with actions or you can create your own in VBA (for example when you click on this button to populate excel cells with selected record in VirtualForm or....)).
And voila the simple form with grid, edit, buttons, filter is created and ready for use.
Sounds complicated, but it is not. My main guideline is that it is as simple as possible. It is easy to complicate things, but it is difficult to solve a complicated thing in an easy and understandable way.
To use this Virtual forms in your excel workbooks there are many ways some of them:
One way: when you put this usercontrol on your workbook or on UserForm it is a simple treeview control where you can create nodes and attach your Virtual Form to double click of this node
Second way: You can simply call it from VBA code like this:
VirtualForm1.ShowVirtualForm "MyVirtualFormName"
For Advanced users there are also many events that are fired by this control in runtime like:
BeforeFormOpen
CommandButtonView
Menu
CommandButton
TxtChange
TxtValidate
TxtCheck
TxtLostFocus
FlexChange
BeforeSave
AfterSave
EditChange
GenerateID
TxtInit
CommandButtonGroupChange
With one line of code (SQL) you can show totals, counts,... (whatever we can do with SQL) in an auxiliary grid.
You can also in runtime reorder and move and reposition the textboxes, columns of grid that are created by the engine
You can also access these texboxes and labels thruu VBA code to get or set properties (Text, Caption, Backcolor, Left, Top,....)
There is also an easy way to add relationships to create Master/Details like Order > Oreder Details, Order Notes,
And more.
Bookmarks