473,414 Members | 1,697 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Progress Bar in Acces 2000

Okay, now then. I'm hoping somebody can help here, pretty please. I want to make a progress bar/indicator on a form. At first I was just going to insert an animated gif, but I've tried and remembered that you can't put an animated gif in there, it becomes static (I did find that out in year 10 at school, I should have known, but that's just me). I can't find an ActiveX control for a progress bat that works (and isn't it true that if you move the database to another computer that doesn't have the controll installed, that it won't work in the database? This particular database may be switched between a few computers.) So I went for what I thought to be a third option. I thought this would be a pretty simple thing to do: Have a drawing box on the form. Then when the form loads, have some code there to make this box bigger. So...
Length = 0
Loop
Delay 100 miliseconds
Increase length
Do Until Length = whatever
But this arrangement doesn't seem to work. This is the code I used:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2. Dim T
  3. T = 0
  4. Form.AllowDesignChanges = True
  5. ProgressBox.Width = T
  6. Do
  7.   Call Sleep(100)
  8.   T = T + 50
  9.   ProgressBox.Width = T
  10. Loop Until T = 3500
  11. Exit Sub
  12. End Sub
I do have the Sleep thingy declared in a code module. The sleep function does work. If I put in a simple little bit of code like:
Expand|Select|Wrap|Line Numbers
  1.  Call Sleep(2000)
  2. Msgbox"This is a delayed mesage box"
  3.  
It works absolutley fine, the delay does work.
If I have this code for the progress indicator on OnOpen, the form does not open at all. If I have it on OnLoad, it loads but the progress bar does nothing. If I put the code into a form button, it does the same.
What a fuss for something so simple. You're probarbly out there thinking what a fool, there is a simple answer. If there is, could one of you kind souls help me out? Either make this makeshift progress indicator work, enlargening the drawind box, or put in a real progress indicator (or even a longshot, help with some other animation?)
If anybody can help, I shall.... erm... well, I have a box that had fresh cream eclairs in it. The are now gone, but I could let you sniff the box, or scrape out some of the cream and chocolate. Or I'll share some Lime and Corriander mini popadoms!
Thanks in advance.
Apr 16 '07 #1
10 4301
Rabbit
12,516 Expert Mod 8TB
Okay, now then. I'm hoping somebody can help here, pretty please. I want to make a progress bar/indicator on a form. At first I was just going to insert an animated gif, but I've tried and remembered that you can't put an animated gif in there, it becomes static (I did find that out in year 10 at school, I should have known, but that's just me). I can't find an ActiveX control for a progress bat that works (and isn't it true that if you move the database to another computer that doesn't have the controll installed, that it won't work in the database? This particular database may be switched between a few computers.) So I went for what I thought to be a third option. I thought this would be a pretty simple thing to do: Have a drawing box on the form. Then when the form loads, have some code there to make this box bigger. So...
Length = 0
Loop
Delay 100 miliseconds
Increase length
Do Until Length = whatever
But this arrangement doesn't seem to work. This is the code I used:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2. Dim T
  3. T = 0
  4. Form.AllowDesignChanges = True
  5. ProgressBox.Width = T
  6. Do
  7.   Call Sleep(100)
  8.   T = T + 50
  9.   ProgressBox.Width = T
  10. Loop Until T = 3500
  11. Exit Sub
  12. End Sub
I do have the Sleep thingy declared in a code module. The sleep function does work. If I put in a simple little bit of code like:
Expand|Select|Wrap|Line Numbers
  1.  Call Sleep(2000)
  2. Msgbox"This is a delayed mesage box"
  3.  
It works absolutley fine, the delay does work.
If I have this code for the progress indicator on OnOpen, the form does not open at all. If I have it on OnLoad, it loads but the progress bar does nothing. If I put the code into a form button, it does the same.
What a fuss for something so simple. You're probarbly out there thinking what a fool, there is a simple answer. If there is, could one of you kind souls help me out? Either make this makeshift progress indicator work, enlargening the drawind box, or put in a real progress indicator (or even a longshot, help with some other animation?)
If anybody can help, I shall.... erm... well, I have a box that had fresh cream eclairs in it. The are now gone, but I could let you sniff the box, or scrape out some of the cream and chocolate. Or I'll share some Lime and Corriander mini popadoms!
Thanks in advance.
Where you put the code depends on what you want to show the progress of.
Have you thought about using the Timer event?

Also a progress bar shouldn't loop like that. Rather it should progress as you get deeper and deeper into the code.

Something like:
Expand|Select|Wrap|Line Numbers
  1. Start Code
  2. Progress(0)
  3. Code
  4. Progress(10)
  5. Code
  6. Progress(50)
  7. Code
  8. Progress(75)
  9. Code
  10. Progress(100)
  11. End Code
  12.  
Apr 16 '07 #2
ADezii
8,834 Expert 8TB
Okay, now then. I'm hoping somebody can help here, pretty please. I want to make a progress bar/indicator on a form. At first I was just going to insert an animated gif, but I've tried and remembered that you can't put an animated gif in there, it becomes static (I did find that out in year 10 at school, I should have known, but that's just me). I can't find an ActiveX control for a progress bat that works (and isn't it true that if you move the database to another computer that doesn't have the controll installed, that it won't work in the database? This particular database may be switched between a few computers.) So I went for what I thought to be a third option. I thought this would be a pretty simple thing to do: Have a drawing box on the form. Then when the form loads, have some code there to make this box bigger. So...
Length = 0
Loop
Delay 100 miliseconds
Increase length
Do Until Length = whatever
But this arrangement doesn't seem to work. This is the code I used:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2. Dim T
  3. T = 0
  4. Form.AllowDesignChanges = True
  5. ProgressBox.Width = T
  6. Do
  7.   Call Sleep(100)
  8.   T = T + 50
  9.   ProgressBox.Width = T
  10. Loop Until T = 3500
  11. Exit Sub
  12. End Sub
I do have the Sleep thingy declared in a code module. The sleep function does work. If I put in a simple little bit of code like:
Expand|Select|Wrap|Line Numbers
  1.  Call Sleep(2000)
  2. Msgbox"This is a delayed mesage box"
  3.  
It works absolutley fine, the delay does work.
If I have this code for the progress indicator on OnOpen, the form does not open at all. If I have it on OnLoad, it loads but the progress bar does nothing. If I put the code into a form button, it does the same.
What a fuss for something so simple. You're probarbly out there thinking what a fool, there is a simple answer. If there is, could one of you kind souls help me out? Either make this makeshift progress indicator work, enlargening the drawind box, or put in a real progress indicator (or even a longshot, help with some other animation?)
If anybody can help, I shall.... erm... well, I have a box that had fresh cream eclairs in it. The are now gone, but I could let you sniff the box, or scrape out some of the cream and chocolate. Or I'll share some Lime and Corriander mini popadoms!
Thanks in advance.
As so gracefully stated by Rabbit, a Progress should not be used in the context you have stated and definately not in conjunction with the Sleep() API Function. It should indicate the status of current code execution up to 100%. If you are simply looking for visual effects, I can create a home grown Progress Bar for you using only a Label and VBA code. Please let me know if you are interested.
Apr 16 '07 #3
Thanks both of you, Rabbit and Adezii. I'm sorry, I must seem so ignorant! I'm trying my best here. I have studied computing and believe it or not I got AA grade in my AVCE ICT. but I'm going to be a nurse, so... well... I'm not exactly an expert in all of this. But I do try.
Anyway, the progress bar I wanted wasn't a real progress bar really, but more a bit of an animation. There's this bit in the database where it does some stuff and hands over to Microsoft Word, and Word does some stuff automatically for a few seconds then closes. All that works absolutley fine. I just wanted a little form to pop up with an animation or progress bar just to show the user that it's doing something and to be patient. I can make a nice little form pop up, like a splash screen, and say "Please Wait". I'm just being shallow and wanting an animation really. I want it to last about 3 seconds. Somewhere between 3 and 5 seconds. If you can help with a... how would we call it, "psuedo progress bar" Adezii, that would be fantastic. This all may seem absolutley pointless, but the database wil be used by a fair few people, including those who aren't too computer literate, and if it seemingly does nothing, people have a tendancy to get frustrated. If they see an animation, something psychologically calms them down :oP. Well, it makes them see something is going on. And yes, I'm being shallow and trying to make it pretty.
Apr 16 '07 #4
Rabbit
12,516 Expert Mod 8TB
Thanks both of you, Rabbit and Adezii. I'm sorry, I must seem so ignorant! I'm trying my best here. I have studied computing and believe it or not I got AA grade in my AVCE ICT. but I'm going to be a nurse, so... well... I'm not exactly an expert in all of this. But I do try.
Anyway, the progress bar I wanted wasn't a real progress bar really, but more a bit of an animation. There's this bit in the database where it does some stuff and hands over to Microsoft Word, and Word does some stuff automatically for a few seconds then closes. All that works absolutley fine. I just wanted a little form to pop up with an animation or progress bar just to show the user that it's doing something and to be patient. I can make a nice little form pop up, like a splash screen, and say "Please Wait". I'm just being shallow and wanting an animation really. I want it to last about 3 seconds. Somewhere between 3 and 5 seconds. If you can help with a... how would we call it, "psuedo progress bar" Adezii, that would be fantastic. This all may seem absolutley pointless, but the database wil be used by a fair few people, including those who aren't too computer literate, and if it seemingly does nothing, people have a tendancy to get frustrated. If they see an animation, something psychologically calms them down :oP. Well, it makes them see something is going on. And yes, I'm being shallow and trying to make it pretty.
Not at all, we've all been there.
I'll let Adezii handle the progress bar.

I just want to make a simpler suggestion, what about a DoCmd.Hourglass to change the cursor to an hourglass. It's easier to implement and only requires two lines of code. One to turn it on and one to turn it off. But by all means, if you prefer the progress bar, go ahead.
Apr 16 '07 #5
Thanks laods for the help, and thanks more for being so patient!
I'll probarbly do the hourgass pointer. I just.... I wanted to do pretty stuff. And in what little experience I've had working with other people doing computing, hourglass pointers seem to get people frustrated just as much as nothing happening lol, I don't know why. I've done stuff like I taught networking to year 12's, desktop publishing to year 9's, basic databases and spreadsheets to year 10's... I always used to help out in younger classes a few times a week when I was at sixth form at school. (And even primary school with 5 year olds doing some word processing). So I've seen a fair. Even silly things like logging on, I'd say "Be patient, it will be a minute or so", and they would all be there actually hitting the mice. Some people are just impatient! Anyway, as this database I'm making is for the youth centre (and going to be used by children as well as adults) I just want to make it as straightforward as possible. And yes, lots of decorations and lots of colours (and yet keeping it clean enough to not be confusing).
And Owww! My wrist jsut cracked!
Any help with this silly animation/progress bar would stull be greatly appreciated.
Apr 16 '07 #6
ADezii
8,834 Expert 8TB
Thanks both of you, Rabbit and Adezii. I'm sorry, I must seem so ignorant! I'm trying my best here. I have studied computing and believe it or not I got AA grade in my AVCE ICT. but I'm going to be a nurse, so... well... I'm not exactly an expert in all of this. But I do try.
Anyway, the progress bar I wanted wasn't a real progress bar really, but more a bit of an animation. There's this bit in the database where it does some stuff and hands over to Microsoft Word, and Word does some stuff automatically for a few seconds then closes. All that works absolutley fine. I just wanted a little form to pop up with an animation or progress bar just to show the user that it's doing something and to be patient. I can make a nice little form pop up, like a splash screen, and say "Please Wait". I'm just being shallow and wanting an animation really. I want it to last about 3 seconds. Somewhere between 3 and 5 seconds. If you can help with a... how would we call it, "psuedo progress bar" Adezii, that would be fantastic. This all may seem absolutley pointless, but the database wil be used by a fair few people, including those who aren't too computer literate, and if it seemingly does nothing, people have a tendancy to get frustrated. If they see an animation, something psychologically calms them down :oP. Well, it makes them see something is going on. And yes, I'm being shallow and trying to make it pretty.
Place this code in the Click() Event of a Command Button for Demo purposes. It actually works much better than originally anticipated. But first, do the following:
  1. Create a Label Control, position it on the Form, and name it lblProgress. The Horizontal positioning is not important, it will be positioned via code but the Vertical positioning is since this will be the actual position of the Progress Bar (Vertically).
  2. Set the Height of the Label. This will be the Height of the Progress Bar.
  3. Set the Special Effect to Sunken (trust me).
  4. Set the Back Style to Normal.
  5. Set the Back Color to any color you so desire. This will be the 'Fill Color' for your Progress Bar.
  6. Set the Visible Property to No.
  7. Delete the Caption for the Progress Bar (lblProgress).
  8. Place this code in the Click() Event of a Command Button and fire away.
Expand|Select|Wrap|Line Numbers
  1. Dim lbl As Label, lngFormWidth As Long, lngUsableWidth As Long
  2. Dim lngCounter As Long
  3. Const lngProgressIndicator As Long = 2000
  4.  
  5. lngFormWidth = Me.Width
  6. lngUsableWidth = Me.Width - 750     'Progress Bar about 1/4 inch from both edges
  7.  
  8. Set lbl = Me![lblProgress]
  9.  
  10. lbl.Left = 350    'about 1/4 inch from edge
  11. lbl.Width = 0
  12. lbl.Visible = True
  13.  
  14. For lngCounter = 1 To lngProgressIndicator
  15.   lbl.Width = Int((lngCounter / lngProgressIndicator) * lngUsableWidth)
  16.   DoEvents
  17. Next
NOTE: Adjust the value of the Constant lngProgressIndicator to achieve a faster or slower progression. Let me know how youo make out.
Apr 16 '07 #7
Thanks loads Adezii. I set up the code linked to a form button, and it worked first time. I've made a few modifications to change the position and time, and it works reliably - from the form button. I can't seem to link the code to the form to get it to automatically run when the form loads for some reason. I've put it in OnCurrent, OnOpen, OnLoad, OnActivate, OnGotFocus, and none of them work. I've not changed the code, only copied and pasted. Put it back in a button, and it works again. Am I missing something? When I put the code in these perameters, with OnLoad for example, what happens is it seems to process the progress bar off screen. The form does not load for roughly the time the bar should be moving. When the form does load a few seconds later, the bar is already at full length. So it looks like the form is not being displayed until after the bar has been drawn.
Any suggestions?
Apr 16 '07 #8
ADezii
8,834 Expert 8TB
Thanks loads Adezii. I set up the code linked to a form button, and it worked first time. I've made a few modifications to change the position and time, and it works reliably - from the form button. I can't seem to link the code to the form to get it to automatically run when the form loads for some reason. I've put it in OnCurrent, OnOpen, OnLoad, OnActivate, OnGotFocus, and none of them work. I've not changed the code, only copied and pasted. Put it back in a button, and it works again. Am I missing something? When I put the code in these perameters, with OnLoad for example, what happens is it seems to process the progress bar off screen. The form does not load for roughly the time the bar should be moving. When the form does load a few seconds later, the bar is already at full length. So it looks like the form is not being displayed until after the bar has been drawn.
Any suggestions?
AhHa! The not so obvious trick here is to place the code in the Form's On Timer() Event, set the TimerInterval to approximately 500, make sure that it only runs once via a Static Boolean Variable, and disable the Timer if it already ran. This approach will work - I've tested it. Let me know what you think:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2. Static blnAlreadyRan As Boolean
  3.  
  4. If Not blnAlreadyRan Then
  5.   Dim lbl As Label, lngFormWidth As Long, lngUsableWidth As Long
  6.   Dim lngCounter As Long
  7.   Const lngProgressIndicator As Long = 2000
  8.  
  9.   lngFormWidth = Me.Width
  10.   lngUsableWidth = Me.Width - 750     'Progress Bar about 1/4 inch from both edges
  11.  
  12.   Set lbl = Me![lblProgress]
  13.  
  14.   lbl.Left = 350    'about 1/4 inch from edge
  15.   lbl.Width = 0
  16.   lbl.Visible = True
  17.  
  18.   For lngCounter = 1 To lngProgressIndicator
  19.     lbl.Width = Int((lngCounter / lngProgressIndicator) * lngUsableWidth)
  20.       DoEvents
  21.   Next
  22.  
  23.   blnAlreadyRan = True
  24. Else
  25.   Me.TimerInterval = 0   'disable Timer and add any other code
  26. End If
  27. End Sub
Apr 16 '07 #9
Hurrah! it works! When I first saw you said to put it in the OnTimer bit I did laugh, I already had stuff in the onTimer event. But just putting that to the end of the code, it all works absolutley fine. I'm sorry if all of this has seemed absolutley pointless, but I thank you both for being so patient and thank you for your help. Isn't it nice when something comes together?
(It may have been pointless and been easier to give up and scrap it, but that's not the way I work.)
Anyway, thanks again. May endless riches and chocolate brownies befall you both. Unfortunatley I have none of those to give you myself. I do have ginger cake though...
Apr 17 '07 #10
ADezii
8,834 Expert 8TB
Hurrah! it works! When I first saw you said to put it in the OnTimer bit I did laugh, I already had stuff in the onTimer event. But just putting that to the end of the code, it all works absolutley fine. I'm sorry if all of this has seemed absolutley pointless, but I thank you both for being so patient and thank you for your help. Isn't it nice when something comes together?
(It may have been pointless and been easier to give up and scrap it, but that's not the way I work.)
Anyway, thanks again. May endless riches and chocolate brownies befall you both. Unfortunatley I have none of those to give you myself. I do have ginger cake though...
Anytime. BTW, I do like ginger cake!
Apr 17 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Martin Mrazek | last post by:
Hi, I check data validity in html form by JS. Something like for (i=0; i<document.form.elements.length; i++) { chechkValidity(i); } Unfortunately, the form has about two thousands elements...
3
by: Chris Kennedy | last post by:
Is there any way of doing a progress bar on a file upload. I have alway used asp with SA File Up but on this particular app there are a lot end users uploading photos which may be quite big, I can...
7
by: Pepi Tonas | last post by:
I have a form that takes some time to load because it has to populate some Data. I was trying to display a form on top of it with an activity bar so that user can see that something's going on. ...
9
by: JoeB | last post by:
Hi, This is 100% reproducable. .NetCF / WinCE5.0 / VS.Net 2003 1. Create a new 'smart device application' project. 2. Add a progress bar to the form 'progressBar1' 3..Add: using...
1
by: daniel_xi | last post by:
Hi all, I am running a VS 2003 .NET project on my client machine (Win 2000 SP4, ..NET framework 1.1), running an ASP.NET application on a remote web server (Win 2000 Server, IIS 6.0, .NET...
5
by: Miro | last post by:
I will try my best to ask this question correctly. I think in the end the code will make more sence of what I am trying to accomplish. I am just not sure of what to search for on the net. I...
0
radcaesar
by: radcaesar | last post by:
Hi All, I Had a script which sync (Copy) tables from Progress DB to MS SQL Server 2000 Data Warehouse everyday. Its an MS SQL 2000 Scripts which connects to PROGRESS DB Using ODBC. At...
3
by: aschauhan18 | last post by:
Hi Does Anybody help me Substitute Of Last() Function Of Ms Acces 2000 in Sql Server 2000 . This is my query...
0
by: jags_32 | last post by:
Hello We use MFG-PRO as our ERP system which in turn uses Progress databases. In the old version of SQL 2000, using DTS packages, we used to set the code page via command prompts and execute DTS...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.