D
Dkline
I have four queries which are run in sequence. All are Select queries.
#1 balance
#2 prorated
#3 calculated
#4 summary
For #1 and #2 I reset the SQL based on User Form entries. No problem with
either one.
#3 and #4 are just to be run - no resetting SQL or anything else. Just
update. Doesn't do it. Modifed date doesn't change.
I've tried forcing the issue by doing a MoveLast and a Requery.
I'm out of ideas.
Code is:
Dim strSQL As String
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Set dbs = CurrentDb
'#1
'qry_balance
'reset the SQL to the user form dates
BuildSQLStringWHERE(strSQL)
dbs.QueryDefs("qrybalance").SQL = strSQL
#2
'qryprorated
'reset the SQL to the user form dates
BuildSQLStringHAVING(strSQL)
dbs.QueryDefs("qryproratedc").SQL = strSQL
#3
'open qrycalculation
Set qdf = dbs.QueryDefs("qrycalculation")
Set rst = qdf.OpenRecordset(dbOpenDynaset)
rst.MoveLast
rst.Requery
rst.Close
Set rst = Nothing
Set qdf = Nothing
#4
'open qrysummary
Set qdf = dbs.QueryDefs("qrysummary")
Set rst = qdf.OpenRecordset(dbOpenDynaset)
rst.MoveLast
rst.Requery
rst.Close
Set rst = Nothing
Set qdf = Nothing
Set dbs = Nothing
#1 balance
#2 prorated
#3 calculated
#4 summary
For #1 and #2 I reset the SQL based on User Form entries. No problem with
either one.
#3 and #4 are just to be run - no resetting SQL or anything else. Just
update. Doesn't do it. Modifed date doesn't change.
I've tried forcing the issue by doing a MoveLast and a Requery.
I'm out of ideas.
Code is:
Dim strSQL As String
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Set dbs = CurrentDb
'#1
'qry_balance
'reset the SQL to the user form dates
BuildSQLStringWHERE(strSQL)
dbs.QueryDefs("qrybalance").SQL = strSQL
#2
'qryprorated
'reset the SQL to the user form dates
BuildSQLStringHAVING(strSQL)
dbs.QueryDefs("qryproratedc").SQL = strSQL
#3
'open qrycalculation
Set qdf = dbs.QueryDefs("qrycalculation")
Set rst = qdf.OpenRecordset(dbOpenDynaset)
rst.MoveLast
rst.Requery
rst.Close
Set rst = Nothing
Set qdf = Nothing
#4
'open qrysummary
Set qdf = dbs.QueryDefs("qrysummary")
Set rst = qdf.OpenRecordset(dbOpenDynaset)
rst.MoveLast
rst.Requery
rst.Close
Set rst = Nothing
Set qdf = Nothing
Set dbs = Nothing