Main form flickers when opening a pop-up form (1 Viewer)

gojets1721

Registered User.
Local time
Today, 11:13
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?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 19:13
Joined
Feb 19, 2013
Messages
16,618
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
 

isladogs

MVP / VIP
Local time
Today, 19:13
Joined
Jan 14, 2017
Messages
18,239
Do you have a timer event on the popup form?
 

gojets1721

Registered User.
Local time
Today, 11:13
Joined
Jun 11, 2019
Messages
430
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
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:13
Joined
Feb 19, 2002
Messages
43,297
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.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:13
Joined
May 7, 2009
Messages
19,245
the main form is continuous form?
 

ebs17

Well-known member
Local time
Today, 20:13
Joined
Feb 7, 2020
Messages
1,949
Main form flickers
I think the main form has its own processes and calculations, maybe conditional formatting, that are triggered there.
 

gojets1721

Registered User.
Local time
Today, 11:13
Joined
Jun 11, 2019
Messages
430
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
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:13
Joined
Feb 19, 2002
Messages
43,297
flickering is caused by code that is running, usually in an endless loop. Try a C&R. Try decompile. We can't see the objects in question so we have to take your word for it that there is no code running.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 19:13
Joined
Sep 12, 2006
Messages
15,658
Maybe the popup causes the screen to change in some way, and the flicker is caused by redrawing the original form.
 

spaLOGICng

Member
Local time
Today, 11:13
Joined
Jul 27, 2012
Messages
127
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.
 

gojets1721

Registered User.
Local time
Today, 11:13
Joined
Jun 11, 2019
Messages
430
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
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:13
Joined
Feb 19, 2002
Messages
43,297
Given your reluctance to show us the code, we have no basis on which to provide further suggestions.
 

gojets1721

Registered User.
Local time
Today, 11:13
Joined
Jun 11, 2019
Messages
430
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
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:13
Joined
Feb 19, 2002
Messages
43,297
I'm not looking to make work for myself but just sayin'. If you want real help, you need to provide actual stuff to work with. There is no way to debug invisible code. It is hard enough to debug code when the entire module is provided. But I can sometimes do that when I haven't misplaced my Karnack the Magnificent hat.
 

gojets1721

Registered User.
Local time
Today, 11:13
Joined
Jun 11, 2019
Messages
430
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

  • Example23.accdb
    624 KB · Views: 77

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:13
Joined
Feb 19, 2002
Messages
43,297
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.
 

Users who are viewing this thread

Top Bottom