I wanted to implement a QR Code to Access2010 and I found https://github.com/yas78/QRCodeLibVBA. Referencing XLAM from Access did not work and I didn't want to insert all modules directly to Access as it makes the project messy. So I decided to create an OCX file using ancient VB6 as it seemed to be the easiest way to encapsulate all the bits together into one simple object.
Finally, I have made an OCX that has several key properties: DataString
which is the string to be displayed, ByteModeCharsetName
, ErrorCorrectionLevel
, ForeRGB
and BackRGB
, there are also methods Refresh
, Cls
and events OnClick
and OnDblClick
It works fine in VB6 apps + Excel sheets + Excel forms but it behaves weird in Access forms, reports, etc.
Everything looks as one would expect in Excel:
This is how it looks in Access:
- The custom properties are visible on the tab "Other" but they are not offered in VBA editor at all! However it does compile when entered manually.
- Resizing control behaves weird
- Control's Events like
OnClick
are not displayed at tab Event of Property Sheet
Here are my questions:
- Are the Controls for Access "different" than for other office apps?
- Why the hell are the properties hidden in editor?
- How to "move" some properties to other tabs (categories), for example
ForeRGB
to tab Format (as usual for TextBoxes etc.)? - How to create
ControlSource
propety (on the DATA tab) which could be directly bound to a recordset without having to use a VBA? This way, I hope, I could use the control on the continuous forms as well. In fact, this is most important question. - Some tips for resizing? (not important)
I think I'm pretty close to my goal but I'm stuck at this point. I know the VB6 is obsolete but after reading Creating Custom Controls for ms access 2010 VB6 seems to be easy choice. Any alternatives for writing OCX?
EDIT: Final working control is available here https://github.com/Combinatix/QRCodeAX