Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 19th, 2007, 10:56 AM
Registered User
 
Join Date: Jun 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Display Form, then perform operation?

I have a form that I'd like to have the system display/paint and then have the code perform with updates of a field showing the status of the "background" operation. How does one do this?

So far, the form is loading after the operations complete and there is a pause in the display that isn't uncomfortable yet. However, I still have some operations to add to the routine, so this pause might possibly get longer.

Thanks,

Michael

 
Old June 20th, 2007, 06:53 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I usually display an intermediate form with a timer on it to open the next form. The intermediate form has some message about waiting for data to load. If you want to go nuts, you can also change the cursor to an hourglass while the data is loading:

DoCmd.Hourglass True
'Load data

DoCmd.Hourglass False
DoCmd.OpenForm 'your next form.

Did that help?



mmcdonal
 
Old June 21st, 2007, 02:49 PM
Registered User
 
Join Date: Jun 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the ideas, but it isn't quite what I want. I may have to go in that direction though. Have used a progress bar and hourglass tricks before so it shouldn't be that difficult.

It still begs the question though. Can what I described be done?

 
Old June 21st, 2007, 03:37 PM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi SandersM,

In the open event of your form (or whatever starts the process)
Have something like:
Code:
DoCmd.Hourglass = True 'Always use hourglass, keep the user informed!
Do
'Business Logic - Whatever you want to do
'Update the display
ProgBar.Value = X
ALbl.Caption = Y
Me.Repaint
DoEvents() 'Optional - Give a bit of CPU time back to OS
Loop Until OpsComplete
DoCmd.Hourglass = False
Does that help?

Best Regards,
Rob

 
Old June 25th, 2007, 12:57 PM
Registered User
 
Join Date: Jun 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found the key to doing this. When you wish to update form controls, the best way to approach it is to not do it from an onLoad or onOpen state. Using another sub to open the form and then change the state/data of the control on the form that it just opened appears to be the only way that you can handle this type of data/display updates.

Thanks to those that helped. It would have taken a lot longer to get to the conclusion had I not had your inputs.

Michael


 
Old June 29th, 2007, 08:50 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

If you have some kind of label that says, "Loading data. Please wait..." then JUST before you actually start loading the data, make the label appear and then do a Me.Repaint on the form itself.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
Want to perform a task after a form opens/displays EdAROC Access VBA 1 June 8th, 2007 08:18 AM
based upon parameter perform action warsha_14 Struts 4 August 5th, 2006 04:51 AM
Connection cannot be used to perform this operatio LibrarianMo Access ASP 1 February 24th, 2006 01:18 PM
How to perform set related operations? hualin_yip Javascript 1 November 9th, 2004 08:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.