[AccessD] Use form field for IN statement in Where clause

Jürgen Welz jwelz at hotmail.com
Tue Dec 6 14:13:14 CST 2005


You could set the .SQL property of the querydef by generating a string with 
a syntax like:
Currentdb.querydefs("qdfABC').SQL = ...[tlkpXrefDescID].[CaseType] in(" & 
[Forms]![FrmBicMoSel]![txtSelCriteria] & ")"


Ciao
Jürgen Welz
Edmonton, Alberta
jwelz at hotmail.com





>From: "Gustav Brock" <Gustav at cactus.dk>
>
>Hi Patricia
>
>Though it would be nice, you can't do this. Look up my post dated:
>   2005-11-21 09:55
>
>subject:
>   SQL - IN Operator - Possible to use parameter
>
>/gustav
>
> >>> Patricia.O'Connor at otda.state.ny.us 05-12-2005 20:14 >>>
>In an Access 97 database
>
>I have a case type field in a reference table that may contain 1 to 11
>values depending on what cases are used in a particular report
>    examples  report 1221 has this type  11
>              report 1321 has these types 11,12,14,16,17
>
>
>The field is placed into a hidden text field on a form called
>[Forms]![FrmBicMoSel]![txtSelCriteria]
>
>The called query currently uses this field in the where statement this
>way
>
>(InStr([Forms]![FrmBicMoSel]![txtSelCriteria],[tlkpXrefDescID].[CaseType
>])>0))
>
>I would like to be able to use it with an IN statement
>[tlkpXrefDescID].[CaseType] in([Forms]![FrmBicMoSel]![txtSelCriteria])
>
>But it does not like this - how can I get this to work - I think there
>is a function but I can't seem to remember it right now.





More information about the AccessD mailing list