reference form property in a function 
Author Message
 reference form property in a function

In an existing application which I am modifying  an auditlog which records
values before and after the changes to the fields.Currently audit log is done
by calling a generic function, i.e.  

        x = auditlog('table','key','keyvalue')

For a few fields in one table a comment also has to entered if the field
changes.  I do not want to rewrite the function since I do not know how many
comments I will have and I do not want to break existing code.  What is best
way of doing this.  Some possiblities I condidered,  
1. add some form properties to hold the comments but can I use them in the
function with out explicitly passing then to the function, if so how?
2. create public variables that get released as soon as I return form
function, do not care for this one if I can avoid it.
3. other ideas?



Sat, 15 Dec 2001 03:00:00 GMT  
 reference form property in a function


Quote:
> In an existing application which I am modifying  an auditlog which records
> values before and after the changes to the fields.Currently audit log is
done
> by calling a generic function, i.e.

> x = auditlog('table','key','keyvalue')

> For a few fields in one table a comment also has to entered if the field
> changes.  I do not want to rewrite the function since I do not know how
many
> comments I will have and I do not want to break existing code.  What is
best
> way of doing this.  Some possiblities I condidered,
> 1. add some form properties to hold the comments but can I use them in the
> function with out explicitly passing then to the function, if so how?

I would pass an object reference to your function - very minimal impact on
your function.

For example:
Your form has THISFORM.COMMENTS as a property.

Change your function to
x = auditlog('table','key','keyvalue',THISFORM)

Auditlog()
LPARAMETER tcTable, tcKey, tcKeyValue, toObject
* reference toObject.COMMENTS to get your comments

Mike

Quote:
> 2. create public variables that get released as soon as I return form
> function, do not care for this one if I can avoid it.
> 3. other ideas?



Sat, 15 Dec 2001 03:00:00 GMT  
 reference form property in a function

says...
Quote:

Thanks will try it.



>> In an existing application which I am modifying  an auditlog which records
>> values before and after the changes to the fields.Currently audit log is
>done
>> by calling a generic function, i.e.

>> x = auditlog('table','key','keyvalue')

>> For a few fields in one table a comment also has to entered if the field
>> changes.  I do not want to rewrite the function since I do not know how
>many
>> comments I will have and I do not want to break existing code.  What is
>best
>> way of doing this.  Some possiblities I condidered,
>> 1. add some form properties to hold the comments but can I use them in the
>> function with out explicitly passing then to the function, if so how?

>I would pass an object reference to your function - very minimal impact on
>your function.

>For example:
>Your form has THISFORM.COMMENTS as a property.

>Change your function to
>x = auditlog('table','key','keyvalue',THISFORM)

>Auditlog()
>LPARAMETER tcTable, tcKey, tcKeyValue, toObject
>* reference toObject.COMMENTS to get your comments

>Mike

>> 2. create public variables that get released as soon as I return form
>> function, do not care for this one if I can avoid it.
>> 3. other ideas?



Sun, 16 Dec 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Can't reference on forms properties from another form

2. Form array properties: passing by reference

3. Cant Reference other Forms Properties

4. Referencing properties on non-active form

5. problem using EVAL() with form property referencing

6. referencing properties in a non-active form

7. Referencing form properties

8. Referencing properties from another form

9. ?? Pass property by reference

10. Help with ActiveX control property references

11. Expert help requested -passing class properties to UDFs by reference

12. Referencing Class Properties

 

 
Powered by phpBB® Forum Software