Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT...... WHERE smthg IN (array)

Status
Not open for further replies.

kolorasta

Technical User
Jul 2, 2002
65
AR
i´ve got a FORM... this from call a REPORT and this report has a SUBREPORT

the SUBREPORT has the Select ....Where id IN (array)


I call the REPORT and passes some parameters and I recive them in the report by the "OpenArgs" variable.
the report name is [Factura B compuesta] ...
so I have this sql sentence in the Record Source field in the subreport.
SELECT....
WHERE (((deudas.id) In (Forms![Factura B compuesta].OpenArgs)) AND ((deudas.cancelada)=False));


Now the question is... how do I have to pass the parameters in the OpenArgs variable??? the syntax...
y tried these and they didn´t work
(4,2,5)
(4;2;5)
4,2,5
4;2;5
"(4,2,5)"
etc...

if I pass only one parametre it works...
for example: (4)

but it doesn't work with more than one parameter

any help will be appreciated

sorry for my poor english

 
I would modify the SQL property of the saved query/record source of the reports. You can set the sql property with DAO code like:

Code:
Dim db as DAO.Database
Dim qd as DAO.QueryDef
set db = currentdb
set qd = db.QueryDefs("qselMyRptQuery")
qd.SQL = "SELECT... FROM... WHERE MyField IN (" & strListOfValues & ");"

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Sorry, I missed the ending code TGML
Code:
Dim db as DAO.Database
Dim qd as DAO.QueryDef
set db = currentdb
set qd = db.QueryDefs("qselMyRptQuery")
qd.SQL = "SELECT... FROM... WHERE MyField IN (" & strListOfValues & ");"

This is kinda all for naught since you already have another thread going with the same basic question.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
ghookom... i was asked to start a new thread, that was why i opened a new similar one... the topic is similar but the content of the thread is a bit different...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top