Refreshing Issue (1 Viewer)

kirkm

Registered User.
Local time
Today, 20:25
Joined
Oct 30, 2008
Messages
1,257
I wonder if anyone may have a resolution for the refreshing as any row in the subform is clicked?
The problem is caused by (or as) the pictures load.

Many thanks for any help. Been trying to fix it myself for several weeks, but nothings seems to make any difference. I have tried two computers and same on both.
 

Attachments

  • dlist.zip
    998.7 KB · Views: 133

June7

AWF VIP
Local time
Yesterday, 23:25
Joined
Mar 9, 2014
Messages
5,424
Not observing any problem. Images change immediately.
 

kirkm

Registered User.
Local time
Today, 20:25
Joined
Oct 30, 2008
Messages
1,257
Thanks for looking. So none of the controls on the top green section flash as the images change?
 

June7

AWF VIP
Local time
Yesterday, 23:25
Joined
Mar 9, 2014
Messages
5,424
There is flicker. Is that the problem?

Alternative is to use Image control ControlSource property: =[CurrentProject].[Path] & "\Vol " & NumbersOnly([subCDTracks]![Folder]) & ".jpg"

Move the NumbersOnly function to a general module.

The images do seem to load a bit slower but there is no flicker/flash.
 

moke123

AWF VIP
Local time
Today, 03:25
Joined
Jan 11, 2013
Messages
3,852
Note that you have year is a reserved word and shouldn't be used as a field name.

You get the flicker because you are calling your code in the OnCurrent event.

You can minimize the flicker if you first test that the current image <> the new current record image. It will only flicker when there is an image change.

Why not just store the image name in your table rather than parse it out?
 

kirkm

Registered User.
Local time
Today, 20:25
Joined
Oct 30, 2008
Messages
1,257
Yes, the flicker is the problem and doesn't change here if the Function is moved to a module.
I did try a test for an image changing, and although better it was still not acceptable.
Would putting the image name in a table help ? It's normally in a array but I altered it for this demo. Would I not still need the .Picture method in the onCurrent event?
While looking for a solution I read a claim the flicker stopped by using Application.Echo in the After Update event. I didn't think that was going to help as there's no after update event.
 

June7

AWF VIP
Local time
Yesterday, 23:25
Joined
Mar 9, 2014
Messages
5,424
Did you try the ControlSource expression as described? Code for .Picture is then not needed. Read post 4 again.

Moving the function is so it will be available to any form - moving was not meant to solve the flicker.
No, putting image name in table will also not eliminate flicker - just eliminates need to call function.

Considering image names provided, RegExp is not need to extract number part.

Val(Mid([Folder], InStrRev([Folder], " ")))

That expression could be used in query and then code or ControlSource expression could reference that calculated field. No VBA procedure is needed. In fact, the entire path can be calculated in query.

Img: [CurrentProject].[Path] & "\Vol " & Val(Mid([Folder],InStrRev([Folder]," "))) & ".jpg"
 
Last edited:

kirkm

Registered User.
Local time
Today, 20:25
Joined
Oct 30, 2008
Messages
1,257
Tell me more? If I put the image name in a table I don't need the function? But wouldn't I then need a Function to put the name into the table?
Is there an advantage to doing that ?
 

June7

AWF VIP
Local time
Yesterday, 23:25
Joined
Mar 9, 2014
Messages
5,424
I added more info to my previous post.

Either user would have to enter image name or code would have to extract/build and populate field. I have suggested expression that can be used and calculated value would not have to be saved.

Place your custom function in a general module and it can be called from query, VBA, ControlSource.

Use the function or don't use the function; calculate in query or VBA or ControlSource - you choose.
 

kirkm

Registered User.
Local time
Today, 20:25
Joined
Oct 30, 2008
Messages
1,257
This was all about the flicker could be resolved and the demo was to demo it. I'm now testing with a Form instead of an Image control. This has eliminated the flicker on the Form controls and buttons but isn't quite perfect yet. There will be many images and I was intending to put their filenames into an array. (Reg edit was an easy way to get the number for the demo). Yes, I could use a table instead of an array. Still developing this so can make changes.
 

moke123

AWF VIP
Local time
Today, 03:25
Joined
Jan 11, 2013
Messages
3,852
Tell me more? If I put the image name in a table I don't need the function? But wouldn't I then need a Function to put the name into the table?
Is there an advantage to doing that ?
Depends on your workflow.
There are many ways to handle images. The name of the file doesn't really matter so technically you could name them something like Early Girls 1.jpg, Early Girls 2.jpg, etc. and use your folder field to concatenate your file path.

I tried the recordsource method and it still flickers, just slower. The .picture method is a much faster flicker and only when there is an image change.

Code:
Private Sub Form_Current()
Dim strPath As String
Dim NoPix As String

NoPix = CurrentProject.Path & "\NoPhoto.jpg"

    If Me.NewRecord Then
    Exit Sub
    End If
    
    strPath = CurrentProject.Path & "\" & Replace(Me.Folder, "\", "") & ".jpg"
    
    If Not FileExists(strPath) Then
    strPath = NoPix
    End If
    
     If Me.Parent.imgPic.Picture <> strPath Then

        Me.Parent.imgPic.Picture = Nz(strPath, NoPix)

    End If

End Sub

I changed the names of your images.
 

Attachments

  • FlacsListHub.zip
    959.7 KB · Views: 134

kirkm

Registered User.
Local time
Today, 20:25
Joined
Oct 30, 2008
Messages
1,257
Thanks for that example Moke. Yes it does flicker severely. And I haven't cottoned onto Junes method for eliminating yet. Been trialing a Form instead of an image control. That, and the test for not the same image, seem the most promising. Here's my code, it's not perfect My pic filename is Images(1) and the Form replacing the image control is "frmImageA"


Code:
If Form_frmImageA.Form.Picture <> Images(1) Then
                DoCmd.Close acForm, "frmImageA"
                    DoCmd.OpenForm "frmImageA", acNormal
                    Form_frmImageA.Form.Picture = Images(1)
                End If
            Else
                Form_frmImageA.Form.Picture = ""
        End If
What has stumnped me, is why do I need to close the Form. If I don't no picture is shown.. You cannot update a Picture with the Form open ?
Also I recall DDGuy said to never use "Form_Form" but it's the only way I've found to avoid an error.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:25
Joined
May 7, 2009
Messages
19,169
does this minimized the flickering?
 

Attachments

  • dlist.zip
    966.6 KB · Views: 136

kirkm

Registered User.
Local time
Today, 20:25
Joined
Oct 30, 2008
Messages
1,257
Yes, changing the image only if a new one certainly is better. Also replacing the image control with a Form and using the Picture property further reduces the flicker on the Forms other controls. Just a pity it can't be eliminated completely. Thanks for trying.
 

June7

AWF VIP
Local time
Yesterday, 23:25
Joined
Mar 9, 2014
Messages
5,424
Not eliminated with setting Picture property but is eliminated if use ControlSource as I describe.
 

kirkm

Registered User.
Local time
Today, 20:25
Joined
Oct 30, 2008
Messages
1,257
June, I would have tried but didn't quite follow what you meant by "control source". I have an array of filenames and the image pic should be the first one in the array. The Curent event puts the required names into the array.
 

moke123

AWF VIP
Local time
Today, 03:25
Joined
Jan 11, 2013
Messages
3,852
here's a non flickering version
 

Attachments

  • noflicker.zip
    983.1 KB · Views: 146

June7

AWF VIP
Local time
Yesterday, 23:25
Joined
Mar 9, 2014
Messages
5,424
Like other data controls, Image control has a ControlSource property. This is how control is bound to table field or has an expression to display a value, or, in case of Image control, an image. VBA and array are not necessary.
 

kirkm

Registered User.
Local time
Today, 20:25
Joined
Oct 30, 2008
Messages
1,257
Right, that's very good. And there's no current event. This is a bit of a learning curve... I didn't know what June meant but can certainly see this is the desired result.
So qryFrmCDTracksSource has a calculated field "CA" and this becomes the control source for the imgPic with format =[subCDTracks].[Form]![CA]

if I'm right, query field CA could point to a Function which returns the correct image file for that record? It won't always be [Application].[CurrentProject].[Path] & "\Vol " & NumbersOnly([Folder]) & ".jpg". In usage it'll be a different path & drive.

But something is driving me batty.. if I open frmCDMain in design view I see all the controls on a green background. This is familiar.
But if I open frmCDTracks first in design view, THEN open frmCDMain in design view I see a big white Window,

Can you help me figure out what's gong on there ?? I'm lost at this point.
The flicker is gone, which is amazing , so salutations to all concerned. This has been extremely valuable.
 

June7

AWF VIP
Local time
Yesterday, 23:25
Joined
Mar 9, 2014
Messages
5,424
Yes, a function can be called to return correct image. It can be called in query, image control, or VBA.

Because a form cannot be open in DesignView in two places. Do the reverse and see what happens.
 

Users who are viewing this thread

Top Bottom