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!

Active X Progress Bar 4

Status
Not open for further replies.

wizcow

Programmer
May 11, 2002
13
CA
I have a splash form that opens for two minutes when my database opens.

I want a progress bar on the form to be zero when the forms opens and fill to be full when the splash form closes.

I have put an active x progress bar on the form but I have no idea how to make it work.

help

Tom
 
Can't help you with the progress bar, but would suggest that it isn't solving your real problem - having to wait 2 minutes for the splash screen. It seems that if you have access to the splash screen such that you could add a progress bar, you could just change the time to something more reasonable (like 5 seconds). Or does it actually take 2 minutes to open the database?
 
Madjock

Thanks for the reply. I am running access 2k and would greatly appreciate any help.
Also I made a typo. The splash stays open for two seconds, not minutes.
I just want the progress meter to look as though it is opening something.

Tom
 
Hi,

OK, the ActiveX control I am using is of class MSComctlLib.ProgCtrl.2. I have placed it on my form and set the properties to not visible.

I then have a button which calls a routine. This routine does my processing and uses the progress bar to show how far it's got.

CODE
Code:
    'Show the progress bar
    Forms![frmAdministrationMenu]![oProgBar].Visible = True
   
   'Initialise progress bar - Set the maximum value of it
   'I suggest 120 (goes up every 1/60th of a second)
    Forms![frmAdministrationMenu]![oProgBar].Max = nMaxValue
    
    'Perform some loop
    for nCount = 1 to 120
    
        'Increment progress bar
        Forms![frmAdministrationMenu]![oProgBar] = nCount

        'Processing of form goes here
        'wait for 1/60th of second - let me know if you need a sleep() routine
    next nCount
    
    'Hide the progress bar again
    Forms![frmAdministrationMenu]![oProgBar].Visible = False

    'And set it back to zero
    Forms![frmAdministrationMenu]![oProgBar] = 0

I think I originally figured out how to use it from MSDN. If you have that, it's example is probable much better than mine!

Hope this helps. Let me know how you go.

Graeme website:
 
Stuff the activex control!
A far easier way is to use 2 rectangles one on top of the other.
Set the bottom one slightly larger than the top one and have a loop in the code that expands the top box a little at a time until it reaches it's maximum size:
Something like

Dim intMaxLength As Integer
intMaxLength = Me.boxTop.Width
Me.boxTop.Width = 0

Do Until Me.boxTop.Width >= intMaxLength
DoEvents
Me.boxTop.Width = (Me.boxTop.Width + 10)
Me.Repaint
Loop

should do what you want.

Give it a go, it's got to be better than messing around with activex controls!

Let me know how you get on.

Ben ----------------------------------
Ben O'Hara
bo104@westyorkshire.pnn.police.uk
----------------------------------
 
Thanks a bunch guys!


The active x progress bar was giving me odd errors. It would work and then it would stop. In order to change the time interval I had to delete the progress bar and add another one, then enter the new time.

For my application the rectangle idea of oharab's worked just great.

Again Thanks!

Tom
 
I'm much of a newbie in Access / VBA still.. Though I understand the idea behind oharab's post, I can't implement it for lack of knowledge. Could you try to give me a small code with both boxes, and how you'd make it work if it was to work for a do loop that went until a recordset's EOF ? (that is, be filled completely when the recordset reaches EOF)

Thanks for your time Catapultam habeo. Nisi pecuniam omnem mihi dabis, ad caput tuum saxum immane mittam.
 
Go to
On the download page get the file ProgressBar.zip

This has an example of both ways of creating the progress bar, from a splash screen or looping through code.
It is an A2k database, but uses DAO, so you will have to make sure to add a reference to DAO3.6 in tools references.
If you are using A97, let me know & I'll convert it.
If you have any questions, let me know.

Cheers

Ben ----------------------------------
Ben O'Hara
bo104@westyorkshire.pnn.police.uk
----------------------------------
 
I'm using 97.

Thank you for your time! Catapultam habeo. Nisi pecuniam omnem mihi dabis, ad caput tuum saxum immane mittam.
 
The file on the website now has both 97 and 2000 versions of the file.
Enjoy

B ----------------------------------
Ben O'Hara
bo104@westyorkshire.pnn.police.uk
----------------------------------
 
You are my hero for today. Thank you :) Catapultam habeo. Nisi pecuniam omnem mihi dabis, ad caput tuum saxum immane mittam.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top