Form flickering with background image (1 Viewer)

Babycat

Member
Local time
Tomorrow, 02:46
Joined
Mar 31, 2020
Messages
275
Hi everyone

My friend is asking me to help him making small Access project for luckydraw like this vid: Virtual Digital Lucky Draw System - YouTube
I have built a similar one (attached db), however i got issue with form flickering. It is actually textboxes flashing when new values are writen.
Remove form background can solve this issue. However the background is required since he even wants to change form background on fly.
(background should normally contains company logo, event sponsors...)

The issue also happens when add high resolution image to the form.

Please help me to review and advise a solution.

Thank you
 

Attachments

  • DB.zip
    3.7 MB · Views: 306
Last edited:

Ranman256

Well-known member
Local time
Today, 15:46
Joined
Apr 9, 2015
Messages
4,339
the system is struggling to show the HD graphic and low res form.
I'd ditch the image.
 

GPGeorge

Grover Park George
Local time
Today, 12:46
Joined
Nov 25, 2004
Messages
1,776
Hi everyone

My friend is asking me to help him making small Access project for luckydraw like this vid: Virtual Digital Lucky Draw System - YouTube
I have built a similar one (attached db), however i got issue with form flickering. It is actually textboxes flashing when new values are writen.
Remove form background can solve this issue. However the background is required since he even wants to change form background on fly.
(background should normally contains company logo, event sponsors...)

The issue also happens when add high resolution image to the form.

Please help me to review and advise a solution.

Thank you
Probably this is indeed a resource problem. The video driver may not be up to the task. Perhaps a very low resolution version of the images would be less of a load on the system.
 

Babycat

Member
Local time
Tomorrow, 02:46
Joined
Mar 31, 2020
Messages
275
the system is struggling to show the HD graphic and low res form.
I'd ditch the image.
Dear Ranman.

Unfortunately, the image is must. I surprised that the form needs to redraw whole thing (and its image as well) while only few small changes in textboxes...
 

Babycat

Member
Local time
Tomorrow, 02:46
Joined
Mar 31, 2020
Messages
275
Probably this is indeed a resource problem. The video driver may not be up to the task. Perhaps a very low resolution version of the images would be less of a load on the system.
The background image size is only 163Kb which i think small enough. I have tried to use Application Echo, but it does not work.

My friend (and me as well) thought this is easy task, but surprisingly I dont have good solution for now
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:46
Joined
May 7, 2009
Messages
19,169
without using Additional Subform, you can set the Background of the Detail Section to Black (instead of dark blue).
 

Attachments

  • DB.zip
    3.9 MB · Views: 281

Mike Krailo

Well-known member
Local time
Today, 15:46
Joined
Mar 28, 2020
Messages
1,030
Very interesting app in that video. Your code for the random numbers isn't working though. It displays duplicate random numbers in the five text boxes. It should be five unique names or numbers out of the hat. I played around with it and got it working. Probably not the best way to do it, but it works now. I also changed the red button to toggle the mixing and selection of the winner.
 

Attachments

  • LuckyDraw.zip
    3.7 MB · Views: 335

Babycat

Member
Local time
Tomorrow, 02:46
Joined
Mar 31, 2020
Messages
275
without using Additional Subform, you can set the Background of the Detail Section to Black (instead of dark blue).
Dear Arnelgp.
Let me check it out soon. I know your solutions are always great.
 

Babycat

Member
Local time
Tomorrow, 02:46
Joined
Mar 31, 2020
Messages
275
Very interesting app in that video. Your code for the random numbers isn't working though. It displays duplicate random numbers in the five text boxes. It should be five unique names or numbers out of the hat. I played around with it and got it working. Probably not the best way to do it, but it works now. I also changed the red button to toggle the mixing and selection of the winner.
Thank Mike.

The random number is just for example. The name list will be imported from an excel file, but I have not done that part yet.
Let me study your code.
I much appreciated your helps.
 

Babycat

Member
Local time
Tomorrow, 02:46
Joined
Mar 31, 2020
Messages
275
without using Additional Subform, you can set the Background of the Detail Section to Black (instead of dark blue).
Hi @Arn

Nice trick, It works very well if piture background is same to form's background.
But if i want option to change background on the fly, then how I should do?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:46
Joined
May 7, 2009
Messages
19,169
just make sure that when you change the background image, you also
change the Background Color of the Details section (same color as your image color).

like on your sample the image color is black, so i change the detail background color to black also.
 

Babycat

Member
Local time
Tomorrow, 02:46
Joined
Mar 31, 2020
Messages
275
Hi @arnelgp ,
I meant end-user wants to change the background. They just need to click on a button, browse to picture location and OK.
So they have no ability to change form's background color.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:46
Joined
May 7, 2009
Messages
19,169
can you just give the user an option to select from a "pre-defined" images on a separate form.
like you save some images in an Attachment field.
the image must have, majority of its surface, painted with basic color, ie, blue, red, green, black, etc.
so you can, in vba, change the detail background color appropriately.

if the image selected has too many color, it might again flicker your other controls.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:46
Joined
May 7, 2009
Messages
19,169
i edit the form and change the detail backcolor to default (white).
then i check each control and make sure they are not Overlapping each other.
i right-click each control and set their Position->Bring to Front.

i think this minimizes the flicker.

i added a button to change image.

you test it.
 

Attachments

  • RNPK.accdb
    6.5 MB · Views: 307

Babycat

Member
Local time
Tomorrow, 02:46
Joined
Mar 31, 2020
Messages
275
@arnelgp .
Much appreciated your helps. I tested with few images, the flickering is minimal, i think it acceptable.
btw: To select and dispaly random subset from TBLNAMELIST, I think about steps:

1. Generate 5 unique ID number from 1 to N with N = Dcount("*", "TBLNAMELIST")
- Run rand() 5 times, and check if any of them have same ID to correct...
2. Build a SQL string to extract these 5 ID strings from TBLNAMELIST, store it into TBLTEMP1
3. Transform TBLTEMP1 to TBLTEMP2 that each ID is stored in a field such as ID1_String in Field1, ID2_String in Field2....so on.
4. Refresh form MAIN (bound to TBLTEMP2), Box1 bound to Field1, Box2 bound to Field2....

Would it better than using Dlookup to fillup Box1, Box2...?

I think with list of thousand names. Dlookup might take time and slowdown the overall progress

Please feel free to advise
 

Mike Krailo

Well-known member
Local time
Today, 15:46
Joined
Mar 28, 2020
Messages
1,030
1. Generate 5 unique ID number from 1 to N with N = Dcount("*", "TBLNAMELIST")
- Run rand() 5 times, and check if any of them have same ID to correct...
2. Build a SQL string to extract these 5 ID strings from TBLNAMELIST, store it into TBLTEMP1
3. Transform TBLTEMP1 to TBLTEMP2 that each ID is stored in a field such as ID1_String in Field1, ID2_String in Field2....so on.
4. Refresh form MAIN (bound to TBLTEMP2), Box1 bound to Field1, Box2 bound to Field2....

Would it better than using Dlookup to fillup Box1, Box2...?
You are correct about using the dlookup, that is too slow with thousands of names. The code I wrote was thrown together to fast without thinking about that. I switched to using arrays on this.

I was thinking, what if the Excel import has the unique ID numbers already and they start at 1001 or something like that. The reason I say that is because of the situation where out of 2,000 names, there could be some that are exactly the same. You must be able to uniquely identify each name with more information in the Box3 display or concatenate a unique ID to the name like they did in the video demo. It's something to consider. This could then be loaded directly into an module level array at form load time. I have changed the code I was working on to do that. Have a look at it. It is working well with over 2,000 names on the list. I'll post what I was working on later.
 

Babycat

Member
Local time
Tomorrow, 02:46
Joined
Mar 31, 2020
Messages
275
Dear Mike

Thank for spending your time on this topic.
I know Dlookup function takes long time.
How do you think about step 2 and 3 in post #17 ? I am doing the code to check them out.
 

Mike Krailo

Well-known member
Local time
Today, 15:46
Joined
Mar 28, 2020
Messages
1,030
I'm curious how you would pull out the random names using sql. As far as concatenating the ID with name, yes. That was the same route I took as well.

I'll show you what I have sometime today. I haven't worked with arrays in a while so there is one more bug to work out.

The code to make the five unique random names is tricky if using smaller name lists and then extracting winners from that small list. There must be a minimum of five names available to populate the boxes. Of course if you don't care about tracking multiple winners then it doesn't matter. I just thought that would be a nice feature.

I just had a better idea on generating the other four box values. What if instead of creating five random values, we just create one. Then from that one, display the two ID's on either side of the random one. This would emulate having all values on a giant wheel that spins around and shows one value and the few values beside it. Make sense? With this approach, you only need take care of the situation when you are at both ends of the list so it wraps around back to the beginning or end of the list value.

To make sure it all works properly, just make it a rule that you must have at least 10 names minimum on the list to begin with and if more than five names chosen out of the hat to be placed on the winners list, an error is appropriately generated if the number of winners exceeds 50% of the names on the list. In other words, limit the number of winners to be chosen to 50% of total number of names on the list.
 
Last edited:

Users who are viewing this thread

Top Bottom