Form query

  • Thread starter Thread starter Nino
  • Start date Start date
N

Nino

I'm trying to add a criteria to a group by query within a
forms class module, however, I'm getting an error message
that "access can't find the object?" here's part of the
coding:

stDocName = "v4_DAILY_qry_2 WHERE (CID = 'cboSELECT_CID')"
 
I assume you've followed this with an OpenQuery method. The only way to do
what you want is to bind the query to a form (the form can be in Datasheet
view) and use OpenForm with the WhereCondition parameter to filter it.
Assuming cboSELECT_CID is a combo box in this form, build a form called
Form_for_V4_Daily_qry_2 bound to your query and do this:

stDocName = "Form_for_v4_Daily_qry_2"
DoCmd.OpenForm stDocName, WhereCondition:="CID = " & Me.cboSELECT_CID

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
http://www.deanforamerica.com/site/TR?pg=personal&fr_id=1090&px=1434411
 
Thank you
-----Original Message-----
I assume you've followed this with an OpenQuery method. The only way to do
what you want is to bind the query to a form (the form can be in Datasheet
view) and use OpenForm with the WhereCondition parameter to filter it.
Assuming cboSELECT_CID is a combo box in this form, build a form called
Form_for_V4_Daily_qry_2 bound to your query and do this:

stDocName = "Form_for_v4_Daily_qry_2"
DoCmd.OpenForm stDocName, WhereCondition:="CID = " & Me.cboSELECT_CID

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
http://www.deanforamerica.com/site/TR? pg=personal&fr_id=1090&px=1434411
= 'cboSELECT_CID')"


.
 
Back
Top