NigelShaw
10-02-2008, 11:12 AM
hi,
Can you create code with code? I was thinking about writing registration info to a module instead of a table but not really sure where to look. I'm pretty sure it can be done is I've seen something similar but can't for the life of me remember where it was !
It was only basic info I wanted to save like "registered to", "licence number" etc.
Any ideas?
The_Doc_Man
10-02-2008, 11:22 AM
A module is a collection of lines that are numbered. You can generate code in VBA by finding the line before/after which you wish to create your code and start inserting lines. You can then compile the code with ActiveX.
References to search: Access Help on "Collections" "Modules" "Methods" (the latter only for methods associated with the module object.) And search this forum and the Help files for help on traversing collections. I forget the exact nomenclature but I believe there is a method called .Insert or maybe .InsertAfter or .InsertBefore, I forget which one. But it is a "module method" as opposed to a table method or form method or general method.
Note that there are potentially MULTIPLE modules. I think it is either Modules(n) OR Modules.Module_name that is a collection of lines. Modules without a further qualifier is a collection of individually named modules. Also, class modules (form/report-related) are within the associated document (the form or report) and can only be exposed by opening that document at least in design mode. That is, there might be lines in the form's class module but they are not exposed to ActiveX unless they are part of the Forms collection or Reports collection. While they are in the Documents collection, the program lines - like the rest of the form or report - are totally inaccessible.
NigelShaw
10-02-2008, 11:47 AM
hi doc,
Where you say "compile the code with activex", is the something built in or an activex that needs to be added?
Regs
Nigel