?
Solved

Refreshing records on a continuous form

Posted on 1999-07-27
22
Medium Priority
?
348 Views
Last Modified: 2008-02-26
I'm just Mr. Question today :-)

I have a continuous form showing a list of call list records (currently 13 of them). I have a button on the header of this form that opens another form which allows me to enter a new record, runs an append query to add it to the records and closes the 'add new record' form, so the focus is back with the original call list form.  However, the number of records has not changed.  If I add a 'me.refresh' after the sub form has closed, I still don't get the new record.  If I go into design mode and back to preview mode, I still don't get the new record. If I shut the form and re-open it, THEN I get the new record.  The record source for the form is a simple query that has two tables in it: the one I'm updating (call list) and a list of Caller's names (caller names) that's linked by Caller ID.  The query is not just specific to the form, it exists in the 'query' windows as well.  How come the 'refresh' doesn't work and I only see the new record if I close and re-open the form?
0
Comment
Question by:carled
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 6
  • 3
  • +2
22 Comments
 
LVL 3

Expert Comment

by:dsegard
ID: 2002125
For that, you need to use the requery method.

DS
0
 
LVL 10

Expert Comment

by:brewdog
ID: 2002126
dsegard is right on (though an explanation might be helpful :)  )

The refresh method will update all changes to existing data (meaning no additions or deletions will be reflected). The requery method reflects *all* changes to data: edits, adds, deletes. The requery takes a little longer generally (there is no specified set of records in memory to update like with the refresh) and, on a bound form, will always move you back to the first record in the table/query. That is why the requery is sometimes used with the bookmark property, too; then you can requery and return the user to the record they were just viewing.
0
 
LVL 1

Author Comment

by:carled
ID: 2002127
The requery works.  I'm irritated because I'd tried that and it didn't seem to work so I'd disregarded it, but I had the code in the wrong place!

However...
I don't want the user to have to click on the 'requery' button to see the latest records.  I've tried putting the code in just after the subform call, but using the debugger, the system steps through the 'requery' before the subform appears on screen!  I've tried putting in a further subprocedure and calling the subform from that, then performing the requery but as soon as the subform call is done it steps right through the requery and THEN shows the subform on screen.  I seem to need some kind of 'wait' once the subform has been entered.  Alternatively, is there an 'event' that corresponds to the end of processing on a button click?  I tried 'got focus' but that did nothing.
0
Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
LVL 1

Author Comment

by:carled
ID: 2002128
The requery works.  I'm irritated because I'd tried that and it didn't seem to work so I'd disregarded it, but I had the code in the wrong place!

However...
I don't want the user to have to click on the 'requery' button to see the latest records.  I've tried putting the code in just after the subform call, but using the debugger, the system steps through the 'requery' before the subform appears on screen!  I've tried putting in a further subprocedure and calling the subform from that, then performing the requery but as soon as the subform call is done it steps right through the requery and THEN shows the subform on screen.  I seem to need some kind of 'wait' once the subform has been entered.  Alternatively, is there an 'event' that corresponds to the end of processing on a button click?  I tried 'got focus' but that did nothing.
0
 
LVL 1

Author Comment

by:carled
ID: 2002129
The requery works.  I'm irritated because I'd tried that and it didn't seem to work so I'd disregarded it, but I had the code in the wrong place!

However...
I don't want the user to have to click on the 'requery' button to see the latest records.  I've tried putting the code in just after the subform call, but using the debugger, the system steps through the 'requery' before the subform appears on screen!  I've tried putting in a further subprocedure and calling the subform from that, then performing the requery but as soon as the subform call is done it steps right through the requery and THEN shows the subform on screen.  I seem to need some kind of 'wait' once the subform has been entered.  Alternatively, is there an 'event' that corresponds to the end of processing on a button click?  I tried 'got focus' but that did nothing.
0
 
LVL 1

Author Comment

by:carled
ID: 2002130
The requery works.  I'm irritated because I'd tried that and it didn't seem to work so I'd disregarded it, but I had the code in the wrong place!

However...
I don't want the user to have to click on the 'requery' button to see the latest records.  I've tried putting the code in just after the subform call, but using the debugger, the system steps through the 'requery' before the subform appears on screen!  I've tried putting in a further subprocedure and calling the subform from that, then performing the requery but as soon as the subform call is done it steps right through the requery and THEN shows the subform on screen.  I seem to need some kind of 'wait' once the subform has been entered.  Alternatively, is there an 'event' that corresponds to the end of processing on a button click?  I tried 'got focus' but that did nothing.
0
 
LVL 1

Author Comment

by:carled
ID: 2002131
Sorry about the multiple entries... got carried away with the 'retry' button there!

Managed to work around the problem by doing the 'requery' from the subform so by the time I get back to the main form it's all there.

More easy points for DS!
0
 
LVL 10

Expert Comment

by:brewdog
ID: 2002132
so the "other form" you're opening is a subform on the main form? I was thinking it would be a popup form. If that were the case, you could just do:

docmd.openform "YourPopupForm",,,, acdialog
me.requery

with the acdialog argument, the next line of code won't run until the dialog box closes . . . which in this case would be after the user has entered the new record.
0
 
LVL 3

Expert Comment

by:dsegard
ID: 2002133
Yes, it's rather easy today ! It looks like at office : some holidays...

DS
0
 
LVL 10

Expert Comment

by:brewdog
ID: 2002134
step right up! submit your answer and claim your points, dsegard!
0
 
LVL 3

Expert Comment

by:dsegard
ID: 2002135
You provided a complete explanation and spent a lot of time instead showing the right way in a few words like I do sometimes - and often when I make some training for technical support team of my company.

I was snoring in the lounge...

DS
0
 
LVL 1

Author Comment

by:carled
ID: 2002136
Sorry Brewdog, dodgy terminology.  It is, in fact, a pop-up form, not a subform.  I tried the 'acDialog' - it didn't seem to work.  (Maybe I need to set the form to 'popup' or something?)
0
 
LVL 12

Expert Comment

by:Trygve
ID: 2002137
For your information: In Access2000, the refresh method is supposed to also include requerying the data.

You could let the OnClose event of the "other" form requery your main form?
0
 
LVL 1

Author Comment

by:carled
ID: 2002138
True, but as the 'update' button on the pop-up form just runs the query, closes the form, then requeries... it wouldn't make a lot of difference!
0
 
LVL 1

Author Comment

by:carled
ID: 2002139
You want these points or what, DS ?
0
 
LVL 3

Expert Comment

by:dsegard
ID: 2002140
Brewdog has written clear explanation and gave you complete support - not only "use requery...".

It would be unfair to take the answer as mine. Hope you understand my position.

DS
0
 
LVL 1

Author Comment

by:carled
ID: 2002141
Does anyone want these points or shall I delete the question? (Can I delete the question?)

Vote guys - anyone who's interested!
0
 
LVL 1

Expert Comment

by:gigo30
ID: 2002142
Use the requery method. I'll take the points. :)

0
 
LVL 3

Expert Comment

by:dsegard
ID: 2002143
You won't be exhausted at the end of the day...
0
 
LVL 1

Author Comment

by:carled
ID: 2002144
No, come on guys, play the game!

DS, the points are yours - get your answer in, please!
0
 
LVL 3

Accepted Solution

by:
dsegard earned 150 total points
ID: 2002145
Ok Carled.

DS
0
 
LVL 1

Author Comment

by:carled
ID: 2002146
Thankyou
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

719 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