Main form flickers when opening a pop-up form

gojets1721

Registered User.
Local time
Today, 13:09
Joined
Jun 11, 2019
Messages
430
On my main form, I have a command which opens up a pop-up, smaller form. For whatever reason, the main form flickers right when the pop-up form opens up.

It's not a huge issue but it's just a bit jarring on the user side of things. Here's the thing though: it seems to be linked to the form opening from a command. I have another pop-up form that opens by doubling clicking a text box, and the flicker doesn't happen for that. Despite the open form codes for both being identical minus the form name.

Here's my open form code:

Code:
    Dim strFormName As String
    Dim strCriteria As String
    
    strFormName = "frmDates"
    strCriteria = "[ComplaintNumber] =" & Nz(Me.[ComplaintNumber], 0) & ""
    
    DoCmd.OpenForm strFormName, , , strCriteria

Any ideas on why the command version is causing the flicker? Any suggestions on how to fix?
 
My guess would be the focus is transferred to the pop up and the returned to the calling form.

not sure why you code is working anyway since the complaint number is populated in the current event not the open event
 
Do you have a timer event on the popup form?
 
My guess would be the focus is transferred to the pop up and the returned to the calling form.
Any ability to fix that?

not sure why you code is working anyway since the complaint number is populated in the current event not the open event
I'm not sure what you mean. The complaint number is listed in the where condition of the openform code
 
the main form is continuous form?
 
Main form flickers
I think the main form has its own processes and calculations, maybe conditional formatting, that are triggered there.
 
If there is code following the openForm method, it runs after you open the form. If you want to suspend code execution in the calling form, open the popup form as dialog.
There is no code after the openform in the sub
 
Maybe the popup causes the screen to change in some way, and the flicker is caused by redrawing the original form.
 
On my main form, I have a command which opens up a pop-up, smaller form. For whatever reason, the main form flickers right when the pop-up form opens up.

It's not a huge issue but it's just a bit jarring on the user side of things. Here's the thing though: it seems to be linked to the form opening from a command. I have another pop-up form that opens by doubling clicking a text box, and the flicker doesn't happen for that. Despite the open form codes for both being identical minus the form name.

Here's my open form code:

Code:
    Dim strFormName As String
    Dim strCriteria As String
   
    strFormName = "frmDates"
    strCriteria = "[ComplaintNumber] =" & Nz(Me.[ComplaintNumber], 0) & ""
   
    DoCmd.OpenForm strFormName, , , strCriteria

Any ideas on why the command version is causing the flicker? Any suggestions on how to fix?
Hi,

What Code do you have that runs when the Popup opens in the Open Event? What about the Current Event? Do you have any Timers running in the Backgound?

You can sometimes smooth them out by using the DoCmd.Echo False Command before the Open Statement and DoCmd.Echo True when the code has completed.

If you have a lot of Text Boxes with Expressions in them, consider moving them to the Record source, which should be a Query and not the Table. Why? Because you can control sorting and filtering from there more efficiently, as well as limit the Columns to only those that you need to see. It is preferred not to save SELECT Statements as the RecordSource to a Form or Report. Always use a Query. Just a lot easier to manage and way more efficient, because now it becomes re-usable.
 
Hi,

What Code do you have that runs when the Popup opens in the Open Event? What about the Current Event? Do you have any Timers running in the Backgound?

You can sometimes smooth them out by using the DoCmd.Echo False Command before the Open Statement and DoCmd.Echo True when the code has completed.

If you have a lot of Text Boxes with Expressions in them, consider moving them to the Record source, which should be a Query and not the Table. Why? Because you can control sorting and filtering from there more efficiently, as well as limit the Columns to only those that you need to see. It is preferred not to save SELECT Statements as the RecordSource to a Form or Report. Always use a Query. Just a lot easier to manage and way more efficient, because now it becomes re-usable.
There's no additional code that runs. It's only the 'openform' code when using the command. There's nothing in the on current event. No timers anywhere.

It seems to specifically be based on using a command button. I have code in the same form to open a pop up form via a double click on a text box. When doing that, no flicker.

It's bizarre
 
Given your reluctance to show us the code, we have no basis on which to provide further suggestions.
It's in my original post. There's literally just 6 individual subs that open different popup forms, like below:

Code:
    Dim strFormName As String
    Dim strCriteria As String

    strFormName = "frmDates"
    strCriteria = "[ComplaintNumber] =" & Nz(Me.[ComplaintNumber], 0) & ""

    DoCmd.OpenForm strFormName, , , strCriteria

4 are command-based, and then the other 2 open by double clicking on a textbox.

There's no further VBA in the parent or pop up forms than that. I can supply an example DB but I'm not entirely sure of the benefit
 
I gotcha. See attached. I recreated my actual DB into an example as simply as possible.

On the launch form (frmComplaints), open the red command and you'll notice that frmComplaints flickers. Especially the tab control and the record selector.

Yet I have the same code on the 'complaint ID' textbox and there's no issue. When you double click that textbox, it opens the same form using the same code and there's no flicker. Only difference is one is a command and one is a text box double click.

I just can't make sense of it.

Any thoughts?

P.S. the flicker isn't too bad here, likely because of how simple this example DB is. It flickers much longer and more apparent in my actual DB.
 

Attachments

I can't explain the problem, but I found the fix. Make the popup form modal.

1. Personally I hate huge, wide popup forms that take over my whole screen. I find them intrusive and they make me angry as yours did. I moved the form to the second monitor so I could see this webpage but that didn't move the access window and because the form is both popup and Model, I was locked out of the Access window and so had to close the form (at least you didn't remove the x) so I could move the access window to the other screen so I could look at your directions at the same time as the app.
2. The complaints form doesn't need to be that wide.
3. Having two forms bound to the same table open at the same time is the road to disaster. At a minimum, you MUST save the current record BEFORE opening the popup but I would rethink the design.
Hmmm it doesn't seem to work for me. I changed it to modal and it is still flickering...

See attached. Was there anything else you changed?
 

Attachments

I agree with Pat's comments in general but also didn't find making the popup modal helped reduce flicker
Instead I suggest closing the main form when the popup is opened and reopening it when the popup is closed.
Flicker eliminated completely

You would obviously want to return to the same record in the main form which I haven't done
 

Attachments

@isladogs did you also make the mainform normal instead of modal and popup? It may be the combination of doing that and changing the popup to Modal = yes that fixed the flicker for me or maybe it eventually goes away if you open/close the form enough:)

No I didn't ... but I have now - still flickers just as before

Also, don't close the first form. Just hide it

Me.Visible = False
DoCmd.OpenForm .... '''''' only works for Model forms
Me.Visible = True

Obviously this only works when the form being opened is model because otherwise, the code in the main form doesn't stop so it would just immediately show the original form after opening the modal and not wait for the form to close.

Yes I did try that & it works whether or not the popup form is modal ...but in neither case does it prevent the flicker.
Even if you prevent screen repainting, it still flickers

The only way I found to prevent any flickering was what I suggested. Close the main form when opening the popup
 
I thought this made it clear enough:
Yes I did try that & it works whether or not the popup form is modal ...but in neither case does it prevent the flicker.
Even if you prevent screen repainting, it still flickers
 

Users who are viewing this thread

Back
Top Bottom