Progress bar of achived target (1 Viewer)

kokowawa

Member
Local time
Today, 23:39
Joined
May 11, 2020
Messages
51
i need your help experts , i am bulding a database with Sales Employee that have a monthly target to achive , i want to make a progress bar that show to him in main menu how much did he achived from his target , where the progress bar stops in the percent of what he have achived that takes the monthly target from a table , and sum of his sales from another table .

for example , like below pic, if the employee achived 1250$ out o 5000$ target the progress bar stops in the percent of 25%

i have tried to modify the code in the below example but i faild .
@isladogs
@arnelgp

mendipdatasystems.co.uk/progress-bar/4594424316

i appriciat any help you can present .

1592236815545.png
 

Isaac

Lifelong Learner
Local time
Today, 14:39
Joined
Mar 14, 2017
Messages
8,738
This should be pretty simple, I have done a progress bar a lot during loops .... In this case it would be more static. You declare a double variable, assign its value as the achievement/target. Then you have 2 labels..a bottom (black) and a little lable on top of it (yellow, say). the top label you simply set its .Width property: Me.TopLabel.Width = Me.BottomLabel.Width*DoubleVariable, so that the top label covers the bottom label by the percentage achieved.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 17:39
Joined
May 21, 2018
Messages
8,463
Maybe something like this, using the above idea. A couple things to account for is more than 100% completion and the little gap you show between the beginning of the bar and the background.
 

Attachments

  • CompletionBar.accdb
    608 KB · Views: 155

kokowawa

Member
Local time
Today, 23:39
Joined
May 11, 2020
Messages
51
thank you very much for fast reply , for 99% this simple code dose what i need , i will try to add dlookup and put it instead of Goal = 5000 to find target amount based on month and employee name and total sale from a query by dlookup also .

3 other things ,
1- can we show the percentage amount of what he achived beside the bar.
2-can we do the progress bar animated to grow on time interval and stop on the percentage of achived amount like the database i attached .
3- how to do the same in a continues view form.
or this will be much to ask :D
 

Attachments

  • Progressbar.accdb
    2.1 MB · Views: 161
Last edited:

isladogs

MVP / VIP
Local time
Today, 21:39
Joined
Jan 14, 2017
Messages
18,186
Hi
You said you failed when you tried my progress bar:

It should be very easy. What problem did you have?
 

kokowawa

Member
Local time
Today, 23:39
Joined
May 11, 2020
Messages
51
Hi
You said you failed when you tried my progress bar:

It should be very easy. What problem did you have?

i didnt figure out how to link the code to my tables and how stop the move of the progress bar on the percentage amount of what is the sales person achived out of his target as i dont want the progress to compelet to 100% unless he achived 100% of his target
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 17:39
Joined
May 21, 2018
Messages
8,463
If you want this animated (which I do not get since it really is a completion bar not a progress bar) then I would go with @isladogs link. Using that you should be able to first determine Sales and Target amount doing a dlookup or other means. Then you can loop from 1 to Sales and increment the progress bar. If you can post a demo of what you have it can help.
 

kokowawa

Member
Local time
Today, 23:39
Joined
May 11, 2020
Messages
51
If you want this animated (which I do not get since it really is a completion bar not a progress bar) then I would go with @isladogs link. Using that you should be able to first determine Sales and Target amount doing a dlookup or other means. Then you can loop from 1 to Sales and increment the progress bar. The progress bar is set up as a pop up form, but I am guessing you can do it as a subform instead. If you can post a demo of what you have it can help.

i have made small modification to the sample accdb , please see attached accdb file , it give error . somthing i missed to do.

the animated bar is not that important for me , if it can be done than great it will add some effect to the salse person screen.

1592254239394.png
 

Attachments

  • CompletionBar.accdb
    448 KB · Views: 152

isladogs

MVP / VIP
Local time
Today, 21:39
Joined
Jan 14, 2017
Messages
18,186
Having read this thread properly I agree this should be a completion bar.
Using a progress bar with animation would cause a small time delay and be distracting in my opinion.

Modify your code as follows
Code:
Public Sub MakeProgress()

Dim goal As Integer
goal = Me.Text42
....

Recommend you use meaningful names rather than Text42
 

kokowawa

Member
Local time
Today, 23:39
Joined
May 11, 2020
Messages
51
Having read this thread properly I agree this should be a completion bar.
Using a progress bar with animation would cause a small time delay and be distracting in my opinion.

Modify your code as follows
Code:
Public Sub MakeProgress()

Dim goal As Integer
goal = Me.Text42
....

Recommend you use meaningful names rather than Text42

@isladogs
@MajP

thank you very much , it fixed the error.
i have self learned access . so i am not pro in it as u all are .
you all helped me much , i am greatful to you all .
 

kokowawa

Member
Local time
Today, 23:39
Joined
May 11, 2020
Messages
51
here is the final design for how it looks
thank you all for support .

the bar here is a commanf button with theme .

i want to change the color of the button to be linked with the achived of the target , like under 25% the button color will be red , between 25 and 75% the button theme to be orange and above 75% the button be green like the theme styles below.
if you can help , how can i change the theme color of the bar (button) using VBA.
i have tried many codes i searched for but it only change the back color to a normal color not themed like this one

1592440412937.png


1592440650875.png
 

isladogs

MVP / VIP
Local time
Today, 21:39
Joined
Jan 14, 2017
Messages
18,186
You need to refer to one of the following types of colour value:
1. For standard colours you can use e.g. vbRed, vbBlue, vbCyan but that limits you to 8 possible colours
2. RGB values e.g. RGB(128, 25, 100)
3. OLE values e.g, 128 for dark red

In case it helps, see my Colour Converter utility
 

kokowawa

Member
Local time
Today, 23:39
Joined
May 11, 2020
Messages
51
You need to refer to one of the following types of colour value:
1. For standard colours you can use e.g. vbRed, vbBlue, vbCyan but that limits you to 8 possible colours
2. RGB values e.g. RGB(128, 25, 100)
3. OLE values e.g, 128 for dark red

In case it helps, see my Colour Converter utility

you alwayes have reply for me. thank you dear .

but can't we change the button theme by vba because it have more visual effect than solid color .

i have tried this command but it have only 2 options true and false
CommandButton.UseTheme property
 

Micron

AWF VIP
Local time
Today, 17:39
Joined
Oct 20, 2018
Messages
3,476
PMFJI and sorry if this has already been mentioned but did you consider if the button BackThemeColorIndex property will do what you want? The value range is 0 to 11 for this property - 4 to 9 are the accent values, which I imagine are what you'd want. You could try creating a test form that will cycle through and apply the values to a button that you click. I imagine the results will depend on which Office theme you have applied to the db.
It's BC here (before coffee) and I didn't want to read all of this to try to figure out if it was applicable to your latest question.
 

Micron

AWF VIP
Local time
Today, 17:39
Joined
Oct 20, 2018
Messages
3,476
the bar here is a commanf button with theme .
Just remembered another technique I've used for this. Create an image in an app that lets you create a rectangle with a gradient fill, then use that in an image control and set it's tile property (if I recall the name of that property option correctly) along with the control width according to the percentage you calculate. You end up with a nice looking bar with 3D effects. In your case, you could have as many images as required by the percentage values and could make something more pleasing to you than just a command button limited by theme choices. Here's a gradient rectangle I just threw together in Power Point.

Picture1.png
 

kokowawa

Member
Local time
Today, 23:39
Joined
May 11, 2020
Messages
51
PMFJI and sorry if this has already been mentioned but did you consider if the button BackThemeColorIndex property will do what you want? The value range is 0 to 11 for this property - 4 to 9 are the accent values, which I imagine are what you'd want. You could try creating a test form that will cycle through and apply the values to a button that you click. I imagine the results will depend on which Office theme you have applied to the db.
It's BC here (before coffee) and I didn't want to read all of this to try to figure out if it was applicable to your latest question.


thank you for the help , it leads me to what i need through another code in this link commandbutton-quickstyle-property . but the color number of the button varay from theme to another based on what you select in the office

your reply helped .
 
Last edited:

kokowawa

Member
Local time
Today, 23:39
Joined
May 11, 2020
Messages
51
another sample

mmm , interesting you did it in a smart way for the continus form , i will try to change the graphics to other to have more visual effect .
i will study the code u did and if i dont understand somthing in it i will contact you as i will implement this to my database .

what do you think instead of putting so much images in the database we size the boxForeground to the correct percentage then move the left position and then make the width again small to look like the graphic u did . but i think we will face the same it will not work with the continuse form .
 
Last edited:

Users who are viewing this thread

Top Bottom