D
David McKnight
In the following code my WHERE clause has no effect on query results , ie, I
get results that are not = 4. Also if I change the WHERE to Nameof ="A" I get
an error message indicating that " should be end of statment, So I need to
change to Nameof=A which does nothing to the query results (same as Valueof
problem).
any hints?
Private Sub Command13_Click()
On Error Resume Next
DAO.Workspaces(0).Databases(0).QueryDefs.Delete qry.query3
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Set db = CurrentDb()
Set qdf = db.CreateQueryDef("query3")
qdf.SQL = "SELECT Table1.Yearof, Table1.Dateof, Table1.Nameof,
Table1.Valueof FROM Table1 INNER JOIN Table5 ON Table1.Yearof = Table5.Yearof
WHERE (((Table1.Valueof)=4));"
strSql = "DELETE * FROM [query3 DB]"
CurrentDb.Execute strSql, dbFailOnError
strSql = "INSERT INTO [query3 DB] SELECT [query3].* FROM [query3]"
CurrentDb.Execute strSql, dbFailOnError
Set qdf = Nothing
Set db = Nothing
End Sub
get results that are not = 4. Also if I change the WHERE to Nameof ="A" I get
an error message indicating that " should be end of statment, So I need to
change to Nameof=A which does nothing to the query results (same as Valueof
problem).
any hints?
Private Sub Command13_Click()
On Error Resume Next
DAO.Workspaces(0).Databases(0).QueryDefs.Delete qry.query3
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Set db = CurrentDb()
Set qdf = db.CreateQueryDef("query3")
qdf.SQL = "SELECT Table1.Yearof, Table1.Dateof, Table1.Nameof,
Table1.Valueof FROM Table1 INNER JOIN Table5 ON Table1.Yearof = Table5.Yearof
WHERE (((Table1.Valueof)=4));"
strSql = "DELETE * FROM [query3 DB]"
CurrentDb.Execute strSql, dbFailOnError
strSql = "INSERT INTO [query3 DB] SELECT [query3].* FROM [query3]"
CurrentDb.Execute strSql, dbFailOnError
Set qdf = Nothing
Set db = Nothing
End Sub