CreateQueryDef is a method of a DAO.Database
object. It is not an available method of an ADO connection object.
If your goal is to create an Access query object and if you're doing this with VBA from within an Access session, you can leave ADO out of the picture and use a DAO.Database
object to create the query with the CreateQueryDef
method.
Dim db As DAO.Database
Dim qd As QueryDef
Set db = CurrentDb
Set qd = db.CreateQueryDef("test", "SELECT * FROM Mytable")