Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I refer to a macro line from code?

Status
Not open for further replies.

nagyf

Programmer
May 9, 2001
74
HU
Gentle List Members,

I want to compare two versions of the database.
How can I get a the lines of a macro one by one,
like lines of the modules?

My current workaround idea is to analyze the macros and expont the result in a text file or as object definition table.

Thanx
Frank Ferenc Nagy
|\ /~ ~~|~~~ nagyf@alpha0.iki.kfki.hu Fax: (36-1)-392-2529 New!
| \ | | Institute of Isotope and Surface Chemistry
| \ | -+- 1525 Bp. POB 77. Tel. :(36-1)-392-2550
| \| | `-' ' `-' "The goal of the life is the struggle itself"
 
1. I do not think that it is a good idea to read out macro lines (if ever possible)
2. Use a system table for version control.
3. Forget macros
4. Forget macros
5-1.000.000 Forget macros

The reason for 3-1.000.000 (stolen in the ACCESS Online Encyclopedia at ):

Why should you avoid MACROS ?
Macros have been a great invention back in 1987. In simply recording the operations on the screen any user could create his own little programs and modify them later on.
They are ideal if you just need one functionality and if you do not want to create a real application.
Nethertheless the creation of macros requires time and effort and there is a great chance that all this investment will be lost very soon.
The reasons are multiple:

Macros do not allow any error trapping
Macros can not be debugged
Macros can not be converted in VBA code
Macros are inflexible
Macros are not protected in MDE files
Related topics in the USA ACCESS ENCYCLOPEDIA:
All articles in the MODULES AND VBA section.

Exceptions from the rule

The AUTOEXEC macro will be executed automatically on opening your application
The AUTOKEYS macro can check the function keys throughout the whole application
 
Francescina stated:
Macros can not be converted in VBA code
False!
Right click on the Macro in the database window.
Select Save/Export
Save as
(.) Visual Basic Module
Macros are inflexible
Especially beginners can write and understand macros easier than write code.

My task is to compare the macros of two databse versions:

V1 was copied to V2 on some month ago.
I have been making changes on V2.
I and my coleagues have been making changes on V1.
Now I have to merge the changes to make an official version V3.
I could compare table definitions programatically.
Code:
For each tdef in V1.tabledefs
   read tdef.properties
   write them to a table of my Flexidoc system
   for each fld. in tdef.fields
       read fld.properties
       write them to a table of my Flexidoc system
   next
Next

For each tdef in V2.tabledefs
   read tdef.properties
   write them to a table of my Flexidoc system
   for each fld. in tdef.fields
       read fld.properties
       write them to a table of my Flexidoc system
   next
Next
I could compare modules programatically.
Code:
For all modules of V1
   read module lines
   write them to a table of my Flexidoc system
Next

For all modules of V2
   read module lines
   write them to a table of my Flexidoc system
Next

Finally I made queries about matches and differences.

I could compare macros manually.
Code:
Open database V1
   Tools
   Analyze
   Select all Macros
   Export result to text file V1Macros.txt
Open database V2
   Tools
   Analyze
   Select all Macros
   Export result to text file V2Macros.txt
Compare the results
fk /[options to ignore blanks] V1Macros.txt V2Macros.txt >Macros12.fk
Inspect Macros12.fk

See the difference.
Regards
frank
Ferenc Nagy
|\ /~ ~~|~~~ nagyf@alpha0.iki.kfki.hu Fax: (36-1)-392-2529 New!
| \ | | Institute of Isotope and Surface Chemistry
| \ | -+- 1525 Bp. POB 77. Tel. :(36-1)-392-2550
| \| | `-' ' `-' "The goal of the life is the struggle itself"
 
Frank,
I copyPasted a complete article of the Encyclopedia without making any modifications, have another look to my first contribution.
Your response is very interesting for me. I would have never imagined that a public Institute like yours might develop database applications in such an unprofessional way.
If you continue to work like this you will probably get into big trouble, especially if you continue to use macros.

But maybe I (and the majority of professional Access developers) am wrong, who knows?

Happy programming!
 
> I would have never imagined that a public Institute like > yours might develop database applications in such an
> unprofessional way.
B-(
Thanx for this judgement.
We had never time to make clean and ideal programming work.
Sometimes we could take part at expensive two or threek week long of Access and VB courses.
We had to maintain the database in its old version and platform very different and much more reliable than Microsoft Access,
suffer the demand of even less competent people ruling us from higher authorities, fight for regular data supply of the trade and manufacture and disposal of hazadous radioactive material, fit the programing style of the member of our team.
Such is life.
I'll look after the in the ACCESS Online Encyclopedia at Regards
Frank Ferenc Nagy
|\ /~ ~~|~~~ nagyf@alpha0.iki.kfki.hu Fax: (36-1)-392-2529 New!
| \ | | Institute of Isotope and Surface Chemistry
| \ | -+- 1525 Bp. POB 77. Tel. :(36-1)-392-2550
| \| | `-' ' `-' "The goal of the life is the struggle itself"
 
 I would have never imagined that a public Institute like
 yours might develop database applications in such an
> unprofessional way.
B-(
Thanx for this judgement.
We had never time to make clean and ideal programming work.
Sometimes we could take part at expensive two or threek week long of Access and VB courses.
We had to maintain the database in its old version and platform very different and much more reliable than Microsoft Access,
suffer the demand of even less competent people ruling us from higher authorities, fight for regular data supply of the trade and manufacture and disposal of hazadous radioactive material, fit the programing style of the member of our team.
Such is life.
I'll look after the in the ACCESS Online Encyclopedia at Regards
Frank Ferenc Nagy
|\ /~ ~~|~~~ nagyf@alpha0.iki.kfki.hu Fax: (36-1)-392-2529 New!
| \ | | Institute of Isotope and Surface Chemistry
| \ | -+- 1525 Bp. POB 77. Tel. :(36-1)-392-2550
| \| | `-' ' `-' "The goal of the life is the struggle itself"
 
Hello, Frank,

Please accept my excuses, I should have known that you have your reasons for this programming policy.
Nethertheless, I think that it is important that your realize the inherent risk that lies in it.
If I should ever come to Hungry I will certainly wear a radiation-protective dress ;-)

Again, please accept my apologies and take care of your cute little macros...
 
Francescina,
>Nethertheless, I think that it is important that your realize the inherent risk that lies in it.

Where is the risk?
The risk is in the Microsoft Access itself.
Not I was who has Microsoft Acces choosen.
> If I should ever come to Hungry
From which country? Your member profile contains excellent tables how many advices you have spread out but nothing personal.
Regards Ferenc Nagy
|\ /~ ~~|~~~ nagyf@alpha0.iki.kfki.hu Fax: (36-1)-392-2529 New!
| \ | | Institute of Isotope and Surface Chemistry
| \ | -+- 1525 Bp. POB 77. Tel. :(36-1)-392-2550
| \| | `-' ' `-' "The goal of the life is the struggle itself"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top