I am using the FileCopy function on an Access 97 form to copy various files to variuos locations.
some of these files are very big and i need to show the users that they are not sitting there thinking that the program is not doing anything.
i have already put in the Hourglass so that they know something is happening but what i realy want to do is to have a progress bar going along showing when a file has finished copying.
i know there is an ActiveX component for a progress bar but i dont know how to use it or tell it what to look for.
07-11-2001, 05:27 AM
Include the component by checking the
Microsoft windows common control(6)
from the project-> components menu.
It is a small bar in your tool box with blue shades.
The min property sets the progress bars initial value
The max property sets the Maximum value to it can go and
The Value property will set the current postition of the bar.
Further help can be got from the MSDN library.
I hope this helps...
thanx for that, but unfortunately, reading anything out of the MSDE library is like reading quantum physics.
i understand how to put the bar in and how to set the minimum value and max value but when copying a file, there is no break! how do i tell it to go from one side to the other while it is copying the file?
i enclose the code i am using:
ActiveXCtl140.Value = 10
FileCopy "H:\MyFile.mdb", "C:\MyFile.mdb"
ActiveXCtl140.Value = 12000
my file size is 12mb. what comes in the middle???
all it does now is one box at the beginning and the whole bar filled after the file is copied. i need it to show like you see when you copy a file in windows when the bar goes rather slowly from one side to the other.
whatever help you can give me would be great.
thank you very much
07-11-2001, 07:06 AM
Maybe this will help
Dim progression As Variant
Dim lng as double
Dim compteur as integer
"compteur is a Recordcount on a table or recordset"
progression = SysCmd(acSysCmdInitMeter, "Transfert en cours", compteur)
For lng = 1 To compteur
progression = SysCmd(acSysCmdUpdateMeter, lng)
"do something here"
progression = SysCmd(acSysCmdClearStatus)
This will add a little blue progression bar in the lower part of your screen. If you need more help, search for SysCmd in the help.
well, it does and it doesn't.
it will work if i use it to copy multiple files (so if i have 3 files i can do 1 to 3 and after each file is complete it will add another 3-4 blue boxes to the bar.) but it will not work for 1 file and when it is finished.
so both methods have more of less the same problem.
which is how to tell the bar when the file is being copied and how far has it got to go.
thanx for the help
07-11-2001, 07:37 AM
Well I just got an idea that may solve your problem...
Try to use the ActiveX "ProgressBar" control and upgrade the Value every second (sorry but I don't know how to count the second). Something like this.
Dim counter as Integer
"when a second as past"
counter = counter + 1
progressBar.Value = counter
if "transfert is over"
else goto flag
As you noticed, I didn't try it so you'll have to work on that... if you use it. But hey, maybe you'll have a great idea reading this.
sounds like a good idea. but, as VBA and code goes, the code will not process the next line (in this case "Flag:") until the code line has finished processing.
so by the time the code starts actioning the counter, the file has already finished copying.
i think the trick would be to somehow start a counter while the file gets copied.
thanx for the tip though
Can someone Please help me with this. i'm desparate!
07-13-2001, 04:36 PM
I have wrestled with this on and off, and did not find a solution BUT you could perhaps use the Hourglass function to change the nouse pointer to an hourglass whilst the Comp is thinking.
07-16-2001, 04:33 AM
i would say the idea given by bingpapou can be considered......well the way u put hourglass......if u keep a counter in your loops and increase it as the loops r ending and starting............and assign the value oo the progressbar.value, well i m not sure about it but its just an isea, i might be trying this in couple of days coz i have to use it in one of my coees......
well, i think i know how to do this but, i don't know exactly how.
on VB (not VBA) there is a control called Timer. on each interval of the timer's passing, i can insert a code to tell the progress bar to put another box like this:
private sub timer1_timer()
'and on the program:
private sub Copying_click()
copyfile "C:\myfile.mdb","C:\My documents\myfile.mdb" '(big file)
i'm pretty sure this could work BUT, the timer control only exists in Visual Basic. not VBA.
does anyone have any input on this?
07-19-2001, 02:03 PM
You can set the TimerInterval either in code or in the properties of the Form which the code is in... If TimerInterval is set at 1000 then Timer event fires every second. Better to set it in code as it will not run when not required.
thank you. i did try it but it didn't work so, once again, i'm back to square 1.
thx for the help