k wrote:
Hi
I have a form which the user can apply filters, and push a button to
preview a report. I cannot use me.filter=forms!myform.filter, because
some of the filtered fields are not present in the report. What I would
like is to obtain the ID field from the filtered form, and show only
those ID's in the report.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You'll have to get a comma delimited list of the IDs from the form's
Recordset and pass them to the report in the WhereCondition parameter.
E.g. (this assumes you're using DAO):
' get the list of IDs from the form's Recordset
Dim strIDs As String
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
Do While Not rs.EOF
strIDs = strIDs & rs!ID & ","
rs.MoveNext
Loop
' get rid of trailing comma
If Len(strIDs) > 0 Then strIDs = Left$(strIDs, Len(strIDs)-1)
' Open report w/ IDs
DoCmd.OpenReport "myReport", WhereCondition:="ID In (" & strIDs & ")"
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQi9U0YechKqOuFEgEQKJswCgpGUlG9IFSqnhTjsFSena94 eXhtgAoPjm
XO8PhqGPV2bk2ZKqkHmRQbpS
=jTnu
-----END PGP SIGNATURE-----