Pb with query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

i have pb with this Query,the compiler doesn't recognize the sql statement??

docmd.runsql "SELECT produit.produit_nom FROM produit INNER JOIN (fonction
INNER JOIN compose2 ON fonction.fonction_id = compose2.fonction_id) ON
produit.produit_ID = compose2.produit_id WHERE fonction.fonction_type=""" & x
& """;"

thank u for ur help
 
Hi,

i have pb with this Query,the compiler doesn't recognize the sql statement??

docmd.runsql "SELECT produit.produit_nom FROM produit INNER JOIN (fonction
INNER JOIN compose2 ON fonction.fonction_id = compose2.fonction_id) ON
produit.produit_ID = compose2.produit_id WHERE fonction.fonction_type=""" & x
& """;"

thank u for ur help

If you look in Help you'll see that DoCmd.RunSQL is used for ACTION queries or
DATA DEFINITION queries.

Do you want to open a recordset based on that SQL statement or are you trying to
open a select query?

Regards,
RD
 
Hi,
then you have to use a following syntax:

dim rst as dao.recordset
set rst=currentdb.openrecordset(" SELECT produit.produit_nom FROM produit
INNER JOIN (fonction INNER JOIN compose2 ON fonction.fonction_id =
compose2.fonction_id) ON produit.produit_ID = compose2.produit_id WHERE
fonction.fonction_type=""" & x & """;", dbopendynaset)

if not rst.eof then
'here your code to manipulate with rst

end if
rst.close
set rst=nothing

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
 
Back
Top