GK in the UK
Registered User.
- Local time
- Today, 22:16
- Joined
- Dec 20, 2017
- Messages
- 274
I have a datasheet with a recordset/recordsource set to a non-updateable query. It's a query on several tables.
The user wants to change one of the displayed values on one of the datasheet lines, so it's one field in one of the tables.
So a pop-up window takes the user keyed value and the parent form updates the table in VBA.
Then I need to refresh the recordset so that the value appears in the datasheet, so the SQL query will fetch the data.
This is somehow causing the scroll position to change.
This is the sequence of events:
User highlights a sub form datasheet line, presses a button, pop-up window takes input for new value
Update value in the table in parent form using VBA (non-updateable recordset)
Me.refresh in parent form (running subform.refresh does nothing)
The sub form datasheet refreshes, I can see the value that was keyed into the pop-up form and saved, and the datasheet position has not changed.
Current event of sub form datasheet fires. Why ? I haven't changed the current record.
There is no code in the sub form current event except for a msgbox
The message box displays. All is ok so far, datasheet has not yet scrolled and the new value is still visible.
Then on the very next press of F8 (exiting the sub form current event) the datasheet scrolls.
Seems like a requery, goes back to the first record. But I've stepped through the code, there's no requery. So, refreshing a datasheet which is comprised of a query on several tables must requery ? But I can already see the new value that was saved.
It's really annoying. I can navigate back to the record using FindFirst on a clone recordset, but the record then goes right to the end of the datasheet window when it may have been scrolled centrally. Is there a way to reposition the datasheet to the original position within the window ?
The user wants to change one of the displayed values on one of the datasheet lines, so it's one field in one of the tables.
So a pop-up window takes the user keyed value and the parent form updates the table in VBA.
Then I need to refresh the recordset so that the value appears in the datasheet, so the SQL query will fetch the data.
This is somehow causing the scroll position to change.
This is the sequence of events:
User highlights a sub form datasheet line, presses a button, pop-up window takes input for new value
Update value in the table in parent form using VBA (non-updateable recordset)
Me.refresh in parent form (running subform.refresh does nothing)
The sub form datasheet refreshes, I can see the value that was keyed into the pop-up form and saved, and the datasheet position has not changed.
Current event of sub form datasheet fires. Why ? I haven't changed the current record.
There is no code in the sub form current event except for a msgbox
The message box displays. All is ok so far, datasheet has not yet scrolled and the new value is still visible.
Then on the very next press of F8 (exiting the sub form current event) the datasheet scrolls.
Seems like a requery, goes back to the first record. But I've stepped through the code, there's no requery. So, refreshing a datasheet which is comprised of a query on several tables must requery ? But I can already see the new value that was saved.
It's really annoying. I can navigate back to the record using FindFirst on a clone recordset, but the record then goes right to the end of the datasheet window when it may have been scrolled centrally. Is there a way to reposition the datasheet to the original position within the window ?