Why won't this form open correctly?

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Why won't this form open correctly?

Post by Peter Kinross »

At the end of a bit of vba code, I open a form using:
DoCmd.OpenForm "frmResultsComparedToGoal", acNormal
The form has started opening like this
1.jpg
I have tried opening the form in acDesign mode, then acNormal.
I have tried .Requery on the forms recordsetclone.
I have tried opening the form in acNormal, then acDesign mode, then acNormal.
I have put a 1 second delay before the 2nd re-opening.
None of that makes any difference.
If I manually close the form then manually re-open it it looks as it should, like this
2.jpg
The record source table is:
3.jpg
I'm stumped. What am I doing wrong?
You do not have the required permissions to view the files attached to this post.
Avagr8day, regards, Peter

User avatar
HansV
Administrator
Posts: 78416
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Why won't this form open correctly?

Post by HansV »

What happens if you clear the record source of the form in design view, and instead set the RecordSource property in the On Open (or On Load) event of the form?
Best wishes,
Hans

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Why won't this form open correctly?

Post by Peter Kinross »

Unfortunately that made no diff.
I am biting the bullet and not opening that form by vba. I will insert a message box advising to open the form manually.
Don't like workarounds, but sometimes .....
Thanks anyway Hans.
Avagr8day, regards, Peter

CData
3StarLounger
Posts: 308
Joined: 24 Dec 2015, 16:41

Re: Why won't this form open correctly?

Post by CData »

the open form event is occuring before its record source is available

to debug; rather that trigger the open form - instead trigger the open of the record source - - that should tell you something.

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Why won't this form open correctly?

Post by Peter Kinross »

Thanks CD. It appears to have fixed itself. Absolutely no idea how. The record source is a table, opening (and opening & closing) that before opening the form made no diff.
Avagr8day, regards, Peter

CData
3StarLounger
Posts: 308
Joined: 24 Dec 2015, 16:41

Re: Why won't this form open correctly?

Post by CData »

if it is a linked table - then there could have been a glitch in the network....

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Why won't this form open correctly?

Post by Peter Kinross »

It isn't a linked table. All tables are in this Db. So no network.
So still strange.
Avagr8day, regards, Peter