x taol wrote:
>
Set qd = CurrentDb.QueryDefs("qsXX")
qd.Parameters("parDt") = "#9/1/2006#"
With Me.subFom.Form
.RecordSource = qd.SQL
.Requery
End With
in that case, parameter dialog box appear. why?
what's wrong?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You've created an instance of the QueryDef and then set that instance's
parameter. Then you've taken only the QueryDef's SQL and put it into
the RecordSource of the form. That SQL still has the parameter line
("PARAMETERS parDT Date;") without the value because the QueryDef holds
the parameter value, not the SQL string.
You could just do a Replace() to get rid of the PARAMETERS line and
substitute the date value for the parameter name. E.g.:
strSQL = Replace(qd.SQL,"PARAMETERS parDt DateTime;","")
Me!subForm.Form.RecordSource = Replace(strSQL, "parDT","#9/1/2006#")
You don't have to Requery 'cuz changing the RecordSource automatically
does that.
--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBRTgv9YechKqOuFEgEQL1xgCdEZ18+GOVRMGPpDdp/mkYIReOUfAAoINz
0ba04P5gsxehoruNSWh0O5bL
=DYMY
-----END PGP SIGNATURE-----