Have a report that is driven by a parameter query.
I would like to print it from a command button on a form but don't want the user to have to key in the parameter because it is a nonsensical number that the underlying code already knows.
Is it possible to pass the parameter to the Query that drives the report from VBA code?
(looking at the OpenReport "help" it appears that something can be passed as sql? does this mean that i can code the same sql that is in the parameter query here ?)
something like the following ? note, the actual value i need to pass to the query is in a global string defined as "SAVEKEY"...... it has the argument that the query needs to match on ~ i figured i could pass it as follows but it does not work ~ !
DoCmd.OpenReport stDocName, acPreview, , [ProductInfo.KEY2] = SAVEKEY
The "where" statement in the parameter query that underlies the report reads :
Where (([ProductInfo.KEY2] = [KEY]));
KEY is the name of the parameter ~
Hope it is possible to do something like this ~ driving me nuts !
BTW, thanks in advance !
I would like to print it from a command button on a form but don't want the user to have to key in the parameter because it is a nonsensical number that the underlying code already knows.
Is it possible to pass the parameter to the Query that drives the report from VBA code?
(looking at the OpenReport "help" it appears that something can be passed as sql? does this mean that i can code the same sql that is in the parameter query here ?)
something like the following ? note, the actual value i need to pass to the query is in a global string defined as "SAVEKEY"...... it has the argument that the query needs to match on ~ i figured i could pass it as follows but it does not work ~ !
DoCmd.OpenReport stDocName, acPreview, , [ProductInfo.KEY2] = SAVEKEY
The "where" statement in the parameter query that underlies the report reads :
Where (([ProductInfo.KEY2] = [KEY]));
KEY is the name of the parameter ~
Hope it is possible to do something like this ~ driving me nuts !
BTW, thanks in advance !