Solved Query is not triggered in real time (1 Viewer)

cheberdy

Member
Local time
Today, 07:11
Joined
Mar 22, 2023
Messages
77
I have a textbox Datum in the form Bestandsübersicht where I enter a date. Then I have a query Artikelmenge that takes that date and compares it only to records from the table Warenbewegung. The query sums up the sets of records whose date <= than the textboxDate. However, the query does not work in real time, if I change the date in the date box, then the query does not update even if I press refresh. Can you tell what does not work?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 00:11
Joined
Feb 28, 2001
Messages
27,374
Your query needs to be requeried - but NOT using the .Requery method. You have to re-issue the query as though it were a new query (which, technically, it IS, since you changed something in it.)

From your description, you are either concatenating the value or referencing the control for Datum, the two most common ways to get this kind of value into the SQL string. When you execute the query, you transfer the query string from the Access run-time/GUI environment to the SQL engine's environment, which is in a separate memory space. You didn't say whether you were using native Access or some SQL engine, but in either case, that SQL query, once launched, will return only that which was requested at the time of launch.

This means that a query is executed as though it were a "point in time" snapshot. Once it has been executed, a change of criteria (such as your change in your textbox) is not relevant. The recordset is determined by the last SQL string you gave it and is managed in the SQL engine, which could be ACE or any SQL backend engine.

Note that a potentially confusing setting may come to your attention. For recordset operations, it is possible to set a dbSeeChanges option - which lets you see the recordset you requested, but that recordset will update when SOMEONE ELSE changes data. Your change of criteria is still invisible to the SQL engine unless you re-issue / re-execute the query.
 

Users who are viewing this thread

Top Bottom