Using a Microsoft Access database always requires a plan when developing software applications, which includes the scoping, specification, building and then testing begore using.
Building Access forms and especially automating it with macros or VBA, there are some properties that can help and the one I want to show is the Access Form Tag Property.
Take a look at my video below.
Microsoft Access Database: Using The Tag Property in Microsoft Access Forms
Even reports have this Tag property available but most developers will use Access forms first and foremost.
Want to learn more about Microsoft Access?
Take a look at my eBooks and offers available that is full of rich and valuable information and come with a 100% money back, no questions asked guarantee if not fully satisfied.
Tags: access form design, access tag property, access vba with tag property, microsoft access forms, tag property
Don’t forget to add some VBA code to the Open event of the form required to control and setup the default settings when coding with the Tag property.
Thanks for the video.
I use tag property to selectively change properties basing on the tag…for example below loops through controls on my tab page and highlights (change backcolor to orange) those control which have tag HL
For Each ctl In frmmain(“tabmain”).Pages(“home”).Controls
If ctl.Tag = “HL” Then
ctl.BackColor = RGB(255, 194, 14)
the above works fine…from optimization standpoint is there a way to just restrict loop to only those with tags rather than looping through all controls?
This is an excellent example of how tags can be used and I have used something similar for my control iterations.
I’ve not found or know of a way to further optimise this as you have asked though using For Each loop, this is quite optimised with the added declaration of ctl (as control).
The only way I know that could reduce the number of repeats which is what you are asking is to create a class module for a type of control which is used for a category of use (i.e. as the HL tag) and then you could call the ctl as the type of your class control which would be a sub-set (inheritance of) the general controls.
But the question now is. Is it worth the extra code to create such an object unless it can be used an other (and many instances) processes elsewhere?
I will keep a look out for more ideas on this.
Thanks again for your contribution.