i am a newbie with views and am probably going to ask some very basic questions here. i am more familiar with creating a sql select cursor before running a required report but i have a case were a view seems more appropriate because all the data setup is done in the dataenvironement of the report. the view is very straight forward, estentially ...WHERE cfield = ?mvar.
The view is placed in the data environment of the the report with appropriate relationships. what i would like advice on is how to correctly initialize the ?mvar. how do i pass a variable to a report dataenvironment? the variable mvar is a property of a the calling form. my first attempt is roughly the following.
in the beforeopentables of the report
public mvar
if type('form1') = 'O' AND !isnull('form1')
mvar = form1.mvar
else
mvar= space(20) && fake it out
endif
in the destroy event of the report from
release mvar
the trouble with this is i have to refer to the form name directly. i would prefer thisform.mvar or this.parent.mvar but this does not seem to work. also i'm not happy with the public declaration of mvar.
any suggestions on a better solution would be welcome. also is there a defensive technique for the case where ?mvar is of the wrong type. for instance if i run the view from the command window and get a prompt for the criteria if i put a logical for mvar i get data type mismatch. can the expression be ?(iif(type('mvar'),C,'') or something?
thanks X-)
The view is placed in the data environment of the the report with appropriate relationships. what i would like advice on is how to correctly initialize the ?mvar. how do i pass a variable to a report dataenvironment? the variable mvar is a property of a the calling form. my first attempt is roughly the following.
in the beforeopentables of the report
public mvar
if type('form1') = 'O' AND !isnull('form1')
mvar = form1.mvar
else
mvar= space(20) && fake it out
endif
in the destroy event of the report from
release mvar
the trouble with this is i have to refer to the form name directly. i would prefer thisform.mvar or this.parent.mvar but this does not seem to work. also i'm not happy with the public declaration of mvar.
any suggestions on a better solution would be welcome. also is there a defensive technique for the case where ?mvar is of the wrong type. for instance if i run the view from the command window and get a prompt for the criteria if i put a logical for mvar i get data type mismatch. can the expression be ?(iif(type('mvar'),C,'') or something?
thanks X-)