Re: Forcing a ReQuery

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Michael Keating (michael.keating_at_[S$S$S)
Date: 07/01/04


Date: Thu, 1 Jul 2004 17:22:40 +0100

Hi,

Sorry to be rather negative, but ..

I think you need to copy and paste the actual code here.

>From what you've posted we can assume that queries 3 and 4 utilise the
results of queries 1 and 2, but you appear to only use 3 and 4 to populate a
recordset which you immediately close and destroy.

I get the feeling that the problem is either going to be in the SQL for
queries 1 and 2, which you say works correctly, or in the fact that queries
3 and 4 appear to achieve nothing in this code.

Perhaps the actual procedure will make things clearer. Also a brief
explanation of what you want to happen would help (Modified Date ?? Who
modified that ?? <g>).

MFK.

"Dkline" <Dkline001@comcast.net> wrote in message
news:#rHgoS2XEHA.3944@tk2msftngp13.phx.gbl...
> 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
>
>



Relevant Pages

  • Re: Simpler alternative to replication
    ... queries to create a new table containing all the new data. ... details of report.I have a form for creating a new report. ... Dim rst As DAO.Recordset ... Set rst = db.OpenRecordset ...
    (comp.databases.ms-access)
  • DAO Querydefs
    ... My problem is that a lot of these queries use ... Set Rst = .OpenRecordset ... Dim Qdef As DAO.QueryDef ...
    (comp.databases.ms-access)
  • Can this small function be sped up? VB6 COM ADO (2.8) question...new to this stuff!
    ... enables some UDFs that run database queries on ... multiple, separate databases. ... Set rst = Nothing ...
    (microsoft.public.data.ado)
  • Can this small query be sped up any?
    ... enables some UDFs that run database queries ... on multiple, separate databases. ... Set rst = Nothing ...
    (microsoft.public.vb.database.ado)
  • Re: Forcing a ReQuery
    ... Your code just opens a ... > Dim dbs As DAO.Database ... > Set rst = qdf.OpenRecordset ... > Set qdf = Nothing ...
    (microsoft.public.access.modulesdaovba)