prompts in queries

  • Thread starter Thread starter carol
  • Start date Start date
C

carol

is there a way to setup a multiple prompt, say for output
field [item#]i would like to have a prompt or prompts so
that i can enter several say 3 different item#'s. is
there a way to do this in query? thx.
 
Hi,



WHERE ("," & [parameter] & ",") LIKE ("*," & fieldName & ",*")


with parameter, the prompt you want, it intended being filled such as:
"1,2,5" (no space after the coma)

For a field value being 2, the expression evaluates to:


WHERE ",1,2,5," LIKE "*,2,*"


and so the record is kept. If a record has its field value not in the list,
the expression would evaluate to false, and the record would be disregarded.
You can supply as many arguments as you want in the list, but if you have a
large number of records, that may become relatively slow. In such cases, you
are better using an inner join with a temp table, one field, one value per
record. You need more code to manage that table (delete previous records,
append records), but the search itself would be faster.



Hoping it may help,
Vanderghast, Access MVP
 
thx, will give this a whirl.
-----Original Message-----
Hi,



WHERE ("," & [parameter] & ",") LIKE ("*," & fieldName & ",*")


with parameter, the prompt you want, it intended being filled such as:
"1,2,5" (no space after the coma)

For a field value being 2, the expression evaluates to:


WHERE ",1,2,5," LIKE "*,2,*"


and so the record is kept. If a record has its field value not in the list,
the expression would evaluate to false, and the record would be disregarded.
You can supply as many arguments as you want in the list, but if you have a
large number of records, that may become relatively slow. In such cases, you
are better using an inner join with a temp table, one field, one value per
record. You need more code to manage that table (delete previous records,
append records), but the search itself would be faster.



Hoping it may help,
Vanderghast, Access MVP




is there a way to setup a multiple prompt, say for output
field [item#]i would like to have a prompt or prompts so
that i can enter several say 3 different item#'s. is
there a way to do this in query? thx.


.
 
Back
Top