Solved

Refreshing Data On A continuous Screen, without using ‘Requery’

Posted on 2014-11-05
4
320 Views
Last Modified: 2014-11-05
I developed a continuous screen ‘frmContinuous’ for a client.  The screen usually contains over a 100 records in the data set being worked on by the users.  Many more than can fit on the visible screen.  So the users have to scroll to get to many of the entries.

The recordsource of ’frmContinuous’ is a query combining data from multiple tables and other queries.

Each line on the continuous form has an ‘Edit’ button to the far left.  When the users clicks the ‘Edit’ button they are taken to another screen, ‘frmEdit’ that allows to revise some of the information shown on the continuous form.

When the users exit ‘frmEdit’ and return to ‘frmContinouos’ they want to be positioned on the record they were edting and have the information on ‘frmContinuous’ reflect changes (if any) that had been made in ‘frmEdit’

I don’t seem to be able to accomplish both.
If I don’t execute the ‘refresh’ when they return to frmContinuous, they are positioned exactly where the information on the screen for that record does not reflect any changes they made.

If I execute  a ‘Me.Requery’ when I return to frmContinuous’ the updated information is shown on the screen.  However, it also repositions the cursor to the first record on the screen.  This is particularly time consuming for them because they may have to scroll thru many records to get back to the record they want to work on next.

Is there any way to accomplish both objectives when returning to the continuous for?
1.       Maintain the position in the recordset
2.      Update the information shown on the screen for that record.
0
Comment
Question by:mlcktmguy
  • 2
4 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40424897
Why do do the refresh, then DoCmd.GoToRecord to the same record they were on?
0
 
LVL 24

Expert Comment

by:Bitsqueezer
ID: 40424997
Hi,

you can use "Me.Refresh" instead if you only want to reflect changes to a record, that will not change the position of the record. But if you delete or insert a record you can only use Requery to get the changes.

I developed a "Reposition" method which is able to work with all kind of changes and returns to the edited record and also at the same position on the screen. You can find that here:

Reposition - requery with positioning to the recent record

Cheers,

Christian
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 40425338
Thanks for the responses:

More Info:
No records can be deleted or added on the continuous form or the 'edit' form.

First response
I would like to try this but I'm not familiar with the 'GoToRecord' command.

Could you be more specific as to the coding to implement your suggestion.

This is the code in my 'Edit' click event.

Private Sub btnEdit_Click()
 DoCmd.OpenForm "frmClientDistribution_New", , , , acFormEdit, acDialog, Me.ClientRecID
'Me.Refresh
Me.Requery
End Sub

I'm guessing prior to the 'Docmd.openform... I would have to store something that will take me directly to my record after I return from the form.

Then after the refresh I would use the GotToRecord but I'm not clear on the specifics

Something like:

Private Sub btnEdit_Click()

dim recordpointer as long

recordpointer = ???????
 DoCmd.OpenForm "frmClientDistribution_New", , , , acFormEdit, acDialog, Me.ClientRecID
'Me.Refresh
Me.Requery

docmd.gotorecord ????? recordpointer

End Sub

I tried using 'refresh' instead of 'requery' to stay on the same record but the information on the records was not updated.  It is only updated when I do the 'requery'.
0
 
LVL 1

Author Closing Comment

by:mlcktmguy
ID: 40425513
Here is what I ended up with in my 'Edit' button routine

Private Sub btnEdit_Click()
'
Dim whichRecord As Long
whichRecord = Me.CurrentRecord
'
DoCmd.OpenForm "frmClientDistribution_New", , , , acFormEdit, acDialog, Me.ClientRecID
'
Me.Requery
'
DoCmd.GoToRecord acDataForm, "frmProjectedTransportation_Pre", acGoTo, whichRecord
'
End Sub
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now