T
tdp
Hi--Forgive my question--I have used Access quite a bit but VBA hardly at
all. I need to return a value based on two numerical values in a query. It
could be done with multiple IIf statements in a query, but it would then be
too complex (there are 12 different possible results, and I have read that
you can have a maximum of seven nested statements).
Can you use query field values in a VBA function? If so, how do you get the
"answer" back so you can use it in another query?
Here is an example of what I'm trying to do (I'm not writing the IIf syntax,
but writing it in English so maybe you can understand what types of
parameters I'm dealing with. If using VBA, the case fxn would probably be
easier):
If (qryNRS.LevelID is 2 and qryNRS.SS is between 181 and 200) then
NRSLevelID=2
There would be 11 more statements similar to this because there are 12 NRS
Levels.
The NRSLevelID would then need to be matched with its string value, for
example, NRSLevelID= 2 would be "Beginning ESL". This string value would need
to be in a report or query or form or whatever works, so I would need to be
able to get the function result back somehow to match it up.
If someone could explain to this VBA raw newbie how to go about this, it
would be much appreciated!
Thanks,
tdp
all. I need to return a value based on two numerical values in a query. It
could be done with multiple IIf statements in a query, but it would then be
too complex (there are 12 different possible results, and I have read that
you can have a maximum of seven nested statements).
Can you use query field values in a VBA function? If so, how do you get the
"answer" back so you can use it in another query?
Here is an example of what I'm trying to do (I'm not writing the IIf syntax,
but writing it in English so maybe you can understand what types of
parameters I'm dealing with. If using VBA, the case fxn would probably be
easier):
If (qryNRS.LevelID is 2 and qryNRS.SS is between 181 and 200) then
NRSLevelID=2
There would be 11 more statements similar to this because there are 12 NRS
Levels.
The NRSLevelID would then need to be matched with its string value, for
example, NRSLevelID= 2 would be "Beginning ESL". This string value would need
to be in a report or query or form or whatever works, so I would need to be
able to get the function result back somehow to match it up.
If someone could explain to this VBA raw newbie how to go about this, it
would be much appreciated!
Thanks,
tdp