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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a progress bar and linking it to mail merge loading? 1

Status
Not open for further replies.
Feb 19, 2005
47
0
0
GB
Hi there,

cna any one tell me how to go about creating a progress bar in a form, and triggering it so that it shows progress while the mail merge is loading? thanks!
 
[blue]Progress Bar Info & Setup[/blue]

There are three main operational attributes for a Progress Bar:

[blue]Min[/blue], which defaults to zero and usually needs no setup.

[blue]Max[/blue], the full count of the bar, usually set by the programmer . . . AKA . . . [purple]You![/purple]

[blue]Value[/blue] (and the most important), the current value of the bar, >= min & <= max that is [purple]setup/enumerated by you![/purple]

To setup the Form & ProgressBar, in a new form in [blue]design view[/blue], on the menubar click [blue]Insert[/blue] - [blue]ActiveX Control...[/blue], scroll to and select [purple]Microsoft ProgressBar Control, version 6[/purple]. Click OK.

Size the bar to your liking then, right-click the bar - [blue]ProgCtrl Object[/blue] - [blue]Properties[/blue]. At the bottom, you'll see the combobox for the [blue]Scrolling property[/blue]. Select [purple]Smooth[/purple]. Click OK.

Now set the following properties for the form:

[blue]ScrollBars [purple]Neither[/purple]
Record Selectors [purple]No[/purple]
Navigation Buttons [purple]No[/purple]
Auto Resize [purple]Yes[/purple]
Auto Center [purple]Yes[/purple]
Border Style [purple]Dialog[/purple]
Min Max Buttons [purple]None[/purple]
Caption [purple]Empty/No Value[/purple]
PopUp [purple]Yes[/purple]
Modal [purple]Yes[/purple]
[/blue]

Save/close the form.

Use the following to open the form (in any code that follows, [blue]you![/blue] substitute proper names in [purple]purple[/purple]):
Code:
[blue]   DoCmd.OpenForm "[purple][b]YourFormName[/b][/purple]"
   DoEvents [green]'Allows ActiveX Control to fully refresh.[/green][/blue]

The following is an example of opening, enumerating, and closing the form:
Code:
[blue]   Dim frm As Form, ctl As Control, n As Long
   
   DoCmd.OpenForm "[purple][b]YourFormName[/b][/purple]"
   DoEvents 'Allows ActiveX Control to fully refresh.
   
   Set frm = Forms![purple][b]YourFormName[/b][/purple]
   Set ctl = frm![purple][b]ProgressBarName[/b][/purple]
   
   frm.Caption = "[b]Your TitleBarTextHere![/b]"
   ctl.Max = 1000 'Set max count for the bar
   
   [green]'Sample enumeration. Your enumeration code would go here.[/green]
   For n = 1 To 1000
      ctl = n
   Next
   
   DoCmd.Close acForm, "[purple][b]YourFormName[/b][/purple]"
   
   Set ctl = Nothing
   Set frm = Nothing[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top