Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Indication of background record processing

Status
Not open for further replies.

SamanthaW

IS-IT--Management
Aug 26, 2002
15
0
0
AU
I have developed a database that often has to process and calculate many sales records at one time - up to 20,000. While this processing is under way there is sometimes a considerable pause or time when nothing appears to be happening from the user's point of view.

What is the best way to show some sort of processing indication so that the user knows that something is actually happening?? For example when you wait for a web page to load you see the progressing blue line or when you copy large files you see the page moving from one folder to another.

How can I do something similar in my database, at present I am using a message at the end of the processing but this does not indicate anything to the user while the processing is actually occurring and they may think that nothing is happening.

Any ideas would be appreciated.
 
SamanthaW,
You might try a generic loading form with a ProgressBar control on it.
[ol][li]Create a new form ([tt]frmLoading[/tt]).[/li]
[li]Insert an ActiveX contol: Microsoft ProgressBar Contol[/li]
[li]Add the code to open this form at the begining of your long running routine
[tt]DoCmd.OpenForm "frmLoading", acNormal, , , , acWindowNormal[/tt][/li]
[li]Then set the Max value of this control in your routine to something like the number of records you need to process.
[tt]Forms!frmLoading!ActiveXCtl0.Max = RecodrCount[/tt][/li]
[li]Then as your process runs, index the value of the progress bar
[tt]Forms!frmLoading!ActiveXCtl0.Value = Forms!frmLoading!ActiveXCtl0.Value + 1[/tt][/li]
[li]At the end of your long running routine, close the form
[tt]DoCmd.Close acForm, "frmLoading", acSaveNo[/tt][/li][/ol]

Hope this helps,
CMP



[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Another option: create a new invisible control on the form, make it visible when process starts, change its width during the process and make it invisible at the end
ActiveX controls work, but only if registered.

HTH

[pipe]
Daniel Vlas
Systems Consultant

 
Have a look at the Application.SysCmd method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
How are ya SamanthaW . . .

Just wanted to hilite the post by [blue]danvlas[/blue]:
danvlas said:
[blue]create a new invisible control on the form, make it visible when process starts, change its width during the process and make it invisible at the end
ActiveX controls work, but only if registered.[/blue]
I've used the above method for about 18 months now and very pleased with the results. Only difference is I setup a seperate form for [blue]global use[/blue].
[ol][li]The form can be designed in minutes.[/li]
[li]Access native controls are used, so there's no [blue]portability problems[/blue] or [blue]references required[/blue] as with ActiveX controls (I use to use activeX).[/li]
[li]Since processing of 20K records will give you a [blue]very very slow moving bar[/blue] (for a single bar), its easy to add other bars to show faster activity to the eye (that is a bar moving ten times as fast as the mainbar). I have one form with three bars to handle data processing over 250k records.[/li]
[li]You could use the [blue]SysCmd method[/blue] mentioned by [blue]PHV[/blue]. Its the easiest to use but were talking the progressbar thats on the statusbar. Its the least visible, least appealing bar of them all (at least for me), and its all you get . . . just the one bar.[/li][/ol]
[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Aceman1, I like your idea but can you please elaborate on it. I would love to incorporate it into my db. No rush
 
Thanks everyone for their suggestions - much appreciated. I have tried CMPs suggestion and have that working OK.

I have found that the Progress bar moves slowly and the screen isn't repainted or refreshed often enough to give a smooth effect.

When I have more time on the weekend I will try the suggestions by Danvlas and TheAceMan1.
 
SamanthaW . . .

The basic Idea cromprises two labels one on top the other. The one top indicates the full process, the bottom subprocessing which just runs 10 times faster and resets when it reaches the full length of its bar . . . starting again.
[ol][li]You set a [blue]background color[/blue][/li]
[li]Set the [blue]width[/blue] of the bars to your desire (I chose a [blue]nice healthy 5 inches[/blue]).[/li]
[li]Put a [blue]Box[/blue] (box Tool) around each bar [blue]so you can tell when the bars are approaching completion[/blue].[/li]
[li]Perform your positioning & sizing, then [blue]set the widths to zero[/blue].[/li]
[li][blue]The form is done![/blue][/li][/ol]
Now there's the matter of [blue]incrementing[/blue]. Realize when you increment your [blue]increasing the width of the bar[/blue] ([purple]this is the effect in action[/purple]). So your max count has to relate to the max width of the bar.

Rather that get into all about twips and max counts, add a button to the form for testing and perform the following ([blue]this is for 5 inch bars[/blue]):
[ol][li]Set the Name property for the top bar to [purple]FullBar[/purple].[/li]
[li]Set the Name property for the bottom bar to [purple]SubBar[/purple].[/li]
[li]In the Click event of the button, copy/paste the following:
Code:
[blue]   Dim prpFull As Property, prpSub As Property
   Dim IncFull As Single, N As Long, subCnt As Single
   
   Set prpSub = Me!SubBar.Properties("Width")
   Set prpFull = Me!FullBar.Properties("Width")
   IncFull = (5 * 1440) / 20000
   
   For N = 1 To 20000
      If subCnt < 7200 Then
         subCnt = subCnt + (IncFull * 10) [green]'next SubBar width[/green]
         prpSub = subCnt [green]'increment the SubBar[/green]
      Else
         prpSub = 0 [green]'reset the SubBar[/green]
         subCnt = 0
      End If
      
      prpFull = N * IncFull [green]'increment the FullBar[/green]
      DoEvents [green]'allow the screen to update[/green]
   Next[/blue]
[/li][/ol]
Thats it . . . open the form and hit the button! . . .

For a quick peek of what it should look like, have a peek here Form View Design View

Calvin.gif
See Ya! . . . . . .
 
Thanks so much AceMan1 - I will give it a go on the weekend and let you know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top