Query temporarily shows records that dont match criteria - sql

I have a dashboard form in MS access 2010. This dashboard has a subform datasheet view query which shows outstanding Purchase Orders, where the status' can be submitted, overdue or part delivered. There is also an option for delivered but this isn't in the criteria of the query as they are not "outstanding".
I have another user, who on their front end, is updating deliveries (saving to backend on server). what I see on my front end, is Purchase orders that now have status delivered on my query result.
As I understand the status has been 'updated' and my query results clearly change, but, it is only when I perform an action that requeries the subform when they disappear.
When my query results show delivered, why is this update not removing the records straight off?
is this 'update' different to a requery?
does this update occur directly after the other user changes the record?
Why do I see delivered despite criteria?
I can post the SQL query but I don't think its necessary??
Thanks

The criteria for your subform will only filter out that record when you requery it.
Since you have a split database, you will be unable to add a command to the update routine your coworker is using to requery your control. However, you could set your subform to requery automatically at specific time intervals, so if the data is updated by someone else, the "delivered" record will only appear until the next timed requery command executes. That removes any need for you to actively requery your subform when you notice bad data.
Check out this link on Time Intervals or for further help check out this thread.

I was essentially confusing the difference between Refresh and Requery.
Refreshing records only updates the data that already exists in the datasheet form. It does not display new records, or remove deleted records and records that no longer meet the query criteria.
Requery, as the name suggests, re-runs the query to find what data records meet the query criteria specified for the datasheet form.
I have added a timer to requery my subform regularly, but I have decided that I will simply allow the data to exist until the user performs a database action where I have set a requery to occur.

Related

Access 2013 Form Requery Issue

I have a form that has a parameter query for it's record source - the parameter query asks for an ID number, then the form displays that particular record.
Within the form are a number of buttons that perform various functions (change status etc...) and then requery the form.
My problem is that every requery obviously re-runs the parameter query and asks for the ID number - how can I make the requery use the current ID number and not ask for it?
The button functions are quite simple -
Me.SRStatus = 3
Me.Requery
Regards,
Garry.
Me.Requery will execute the query again, so it will ask for parameters always.
Consider using Me.Refresh instead of Me.Requery
It depends on what you need. You open your form filtered by ID, that's perfect. Then the user makes changes, and here comes the deal.
If those changes are just editing the record, then you don't need to use Me.Requery. Refreshin will update the record and show the changes without calling the query again.
But refreshing won't update if the record is deleted or if you add new records. To show new records/update deleted record/reorder records you are forced to Requery.
If that form is just for editing an existing record, then use Me.Requery so the existing data will be updated without executing the query again (and then asking for a parameter again).
You can read more about this
here
UPDATED ANSWER: OP said that Refresh works, but in event Form_Current got code that enables/disables the buttons according to a field value. So the right answer would be:
Me.Refresh
Call Form_Current

Access 2013 query only pulls the first record

i'm hopeing someone will be able to solve this. I have a combo box which shows the records that are available to view. Upon selecting a record, my query updates without any problem. I tried to use this query within a subform however, for some reason, only the first record in the data set is shown upon selection. When I select anyting else from the available options, the subform doesn't change. However, when i re-select the first record, it shows.
The weird thing is, that when I change the drop down box to say the 2nd record & run the query itself, the desired record shows within the query designer.
To explain further: the combo box is called searchByAcc_cb. This is set so that it retrieves the account name & various other fields from the same table. Below that, there is a subform which is set to requery once another account from the drop down box is selected. When I select the 1st account, the record shows. However, upon selecting the 2nd account, 3rd, etc, nothing shows. I can then re-select the 1st record & i see the account information - so i know it's not a problem with the form updating.
The other strange thing is that upon selecting another account within the drop down box & then running the query from the query designer, the account information is retrieved for the 2nd / 3rd 4th record within the datasheet view. So, i know it isn't a problem with the query.
Any ideas on how to resolve? I've tried deleting the subform & re-inserting it (ensuring that the names match).
For anyone else struggeling with the same problem, I managed to resolve it: You need to delete any reference to the child / master fields within the subforms properties.

Access 2007 need to Force a query update based on a field change in a form?

I have an access database with several calculated fields in text boxes on a form. Most of those update immediately after the data included in the calculation is updated. However I have a couple of those calculated field text boxes that include a data point from a Query, when I update a filed that would impact the query results, those calculated fields do not update correctly until I click through a few records or close and open the form.
How can I force that specific query to update after updating a specific filed on the form?
Try refreshing the form.
Me.Refresh
As an aside, you really should get out of the habit of using bound forms, because you have to end up kludging a bunch of stuff (like this) to get it to work properly, and the Undo functionality (cancelling the entry of a new record) is unstable at best. By unbinding a form, you can have more control over how it reacts to calculated fields and dumping a new data entry is a snap.

How do I prevent a linked field and subform from editing my table in Access?

I have a Date Field and Subform linked by Date (pick a date, all records from that date show up in the subform.)
My problem is that when I pick a date, the most recently accessed record is CHANGED to that date...
I've tried setting Allow Edits on the subform to No but that didn't work. I've fiddled around with a few of the other options to no avail. Is this a simple solution to a simple problem? I have another form with a Date Field and Subform that works just fine, but that one has everything (edits, additions, deletions) set to No.
My ultimate goal is to display all records on a subform by date and delete the selected record.
Thanks!
The field was a bound field, so the table was being edited even though I had Allow Edits set to Off.
I ended up unbinding the field and using queries to (1) display the appropriate records in the subform and (2) delete the selected record. I thought it'd be easier if I could use the bound field, but in the end I would've saved myself some time and headache if I just used queries to begin with.

Combobox Running Code/Query throwing "Recordset is not updateable"

When I click the Combobox, the dropdown list is populated, yet when I try to click on an option it says "Recordset is not updateable".. I have tried to read up on this error yet can't identify the issue behind this. The joins aren't complicated and it has worked before. The query source for the AwardsSubFrm is attached:
Anyone know how to fix this?
The image of the query design indicates your record source is a GROUP BY query. The recordset from any GROUP BY query is never updateable. You can verify that point by opening the query in Datasheet View of the query designer and confirm Access won't let you change any of the values.
I don't know what the fix is for your situation, but you need something other than just a GROUP BY query. Perhaps a subform whose record source contains the table rows you want to update, and link it to the main form so it displays those records which are related to the current main form row.