Hi, I think you might be aiming at building the querydef up (i.e. supplu
table, supply each field, etc.). You need to supply the entire SQL string!
Something like this.
Dim db As DAO.database: set db= DBEngine.Workspaces(0).Databases(0)
dim qdf As DAO.Querydef
dim strSQL As String
' Note: SQL string not tested (shows formula and joining tables)
strSQL = "SELECT tblMember.Name, DateDiff("yyyy", Date(),
tblMember.DateOfBirth) As Age, tblSubscription.SubscriptionType" & _
"FROM tblMember INNER JOIN tblSubscription ON
tblMember.uidMember = tblSubscription.fkMember"
Set qdf = db.CreateQueryDef("MyQuery", strSQL)
db.QueryDefs.Append qdf