A Little Help With Tab Control (1 Viewer)

psyc0tic1

Access Moron
Local time
Today, 07:21
Joined
Jul 10, 2017
Messages
360
I really need this last part to work so I can move on. I already got all of the reporting features working thanks to some great help in another thread and aside from some minor error handling here and there it is complete if I can just get the forms on the tabs to delay loading until the tabs are clicked.

I have re-attached a new copy of the stripped database as things have changed since the last attachment. As before if you login with user2, user2 you will be admin.

Please please please look at it and see what changes need to be made in the frm_home code to make the delaying of form loading until the tabs are clicked.
 

Attachments

  • Test.zip
    631.8 KB · Views: 131

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:21
Joined
Aug 30, 2003
Messages
36,125
Regarding

Me.NewRecordInputForm.SourceObject = "frm_engineerinput"

NewRecordInputForm is the name of the page. Then name of the subform control object is "Patrick Input Form". I wouldn't have spaces in any of the names, but as-is Access won't complain about:

Me.Patrick_Input_Form.SourceObject = "frm_engineerinput"
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:21
Joined
Aug 30, 2003
Messages
36,125
And in case it wasn't obvious, your test must be modified to use those names.
 

psyc0tic1

Access Moron
Local time
Today, 07:21
Joined
Jul 10, 2017
Messages
360
Regarding

Me.NewRecordInputForm.SourceObject = "frm_engineerinput"

NewRecordInputForm is the name of the page. Then name of the subform control object is "Patrick Input Form". I wouldn't have spaces in any of the names, but as-is Access won't complain about:

Me.Patrick_Input_Form.SourceObject = "frm_engineerinput"

it is interesting that I had actually already tried that exact same thing but I got an error regarding the record source either being blank or misspelled (I tried it with the under scores as you suggested) but when I did it again as you said it worked this time.

The database with the linked tables loaded between 15 and 30 seconds which is amazingly fast compared to before.

Being Friday and the chance that many people in my company may have already left for the day... I will try again around noon on Tuesday (that is when I come back to work) and see how it does when the pipes are full.

Thank you MarKK, Mark_, Paul, Colin, Minty, MajP, Gassman, for all of the help you have given me throughout this little thread :D
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:21
Joined
Aug 30, 2003
Messages
36,125
I'd have users whining if something took that long to load. Have you tried removing all the source objects and setting each as needed? Having a single subform control and changing what form is displayed within it has been mentioned by a couple of us. Might help if having multiple loaded at the same time seems to cause an issue.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 13:21
Joined
Jul 9, 2003
Messages
16,282
I note various problems with your database. The first thing is you need to put Option Explicit at the top of all your code pages; the Modules and the Form Modules... The error I am getting is at this line here:-

Code:
Private Sub TabCtl87_Change()

    Select Case Me.CurrentPage.Name
        Case "pg0"
            [COLOR="Red"]Me.NewRecordInputForm.SourceObject = "frm_engineerinput"[/COLOR]

You are referring to the tab page "NewRecordInputForm", you don't need to refer to the pages themselves because as far as MS Access is concerned all of the controls are on the form. However just to qualify, there are certain cases where you might inspect the content of the pages. But that's not necessary for what you are doing...

On that tab page you have a subform/subreport control (which I referred to as a "subform window") named "Patrick Input Form"

So what you really need to do is change the source object of "Patrick Input Form" (Which is NOT a Form again it's a "Subform Window" --- A Subform/Subreport Control)

Your code should look more like this:-

Me.Patrick_Input_Form.SourceObject = "frm_engineerinput"

When you place a sub form on another form you are not actually placing the subform directly on the other form, MS Access creates a hidden control called a subform/subreport control (which I always referred to as a "subform window") if you have a look at my video:-

Search Criteria 11 Nifty Access
https://youtu.be/Gg5xppUNkLo?t=2m18s

From time index 2 minutes 18 seconds you can see a visual explanation of what I'm talking about
 
Last edited:

psyc0tic1

Access Moron
Local time
Today, 07:21
Joined
Jul 10, 2017
Messages
360
I'd have users whining if something took that long to load. Have you tried removing all the source objects and setting each as needed? Having a single subform control and changing what form is displayed within it has been mentioned by a couple of us. Might help if having multiple loaded at the same time seems to cause an issue.

I thought all of this was doing just that... but I kept asking if I needed to remove all of the source objects from the properties but I never got an answer so I just tried it and this no longer works because nothing comes up when the tabs are clicked.

That being said... obviously I was confused on what all of this code work was accomplishing.

I do not know how to make this so it has a single subform control and changing what form is displayed within it.

Any chance you are willing to walk me through that step by step using the database I attached earlier?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:21
Joined
Aug 30, 2003
Messages
36,125
I removed the source object for the first tab and this code works:

Code:
        Case "NewRecordInputForm"
            Me.Patrick_Input_Form.SourceObject = "frm_engineerinput"

You'd have to do the same thing for the other tabs.
 

MarkK

bit cruncher
Local time
Today, 05:21
Joined
Mar 17, 2004
Messages
8,181
Here's the single subform control idea implemented. Tab_Change() event swaps out the subforms. Looks like a tab control, smells like a tab control, but there is nothing on any of the pages.
Hope this helps. If not, just ignore it. :D
Mark
 

Attachments

  • test2.zip
    606 KB · Views: 141

isladogs

MVP / VIP
Local time
Today, 13:21
Joined
Jan 14, 2017
Messages
18,219
Mark
I'm certainly impressed and I'm going to nick this idea for one of my own apps to solve a similar issue.
I hope it works for the OP as well.
 

MarkK

bit cruncher
Local time
Today, 05:21
Joined
Mar 17, 2004
Messages
8,181
Yeah, please, help yourself to this idea. It is very simple and effective.

One hazard when you programmatically change out subforms--if your parent and child forms are bound and related--is that Access may take it upon itself to automatically reset your LinkMasterFields and LinkChildFields properties. You can then reset those properties after the fact, or remove the recordsource from your form in design view, and only apply the recordsource AFTER it loads.

hth
Mark
 

isladogs

MVP / VIP
Local time
Today, 13:21
Joined
Jan 14, 2017
Messages
18,219
Gotcha. Thanks
My issue is slightly different. Late here in the UK but will try it over the weekend
 

Gasman

Enthusiastic Amateur
Local time
Today, 13:21
Joined
Sep 21, 2011
Messages
14,288

isladogs

MVP / VIP
Local time
Today, 13:21
Joined
Jan 14, 2017
Messages
18,219
Richard

As already stated I haven't been involved in this thread but have downloaded and quickly tested MarkK's utility.

IIRC in one of your early threads from 3 months or so ago, pre-tabs, one huge issue was that you were running out of available connections when using linked tables.

I've just done a minor update to the AvailableConnections utility and tested it on Mark's version.
Suggest you do as well as I think you will get a very pleasant surprise.
You can download it from this post https://www.access-programmers.co.uk/forums/showpost.php?p=1590602&postcount=7

HTH
 

isladogs

MVP / VIP
Local time
Today, 13:21
Joined
Jan 14, 2017
Messages
18,219

As frmHome is almost an empty shell, I wonder if your issue lies elsewhere

As the 'subforms' are really separate forms called when needed, I suggest you close frmHome and try opening each of those forms direct from the nav pane to see which is/are the issue

E.g. Do any have layout guides with empty objects?
 

MarkK

bit cruncher
Local time
Today, 05:21
Joined
Mar 17, 2004
Messages
8,181
MarkK,

What is in this DB that prevents me from opening frm_home please?
Did you login with credentials...
user: user2
pass: user2
Open frm_login
Mark
 

Gasman

Enthusiastic Amateur
Local time
Today, 13:21
Joined
Sep 21, 2011
Messages
14,288
Did you login with credentials...
user: user2
pass: user2
Open frm_login
Mark

No Mark, I was not even trying to log in. I opened it with the shift key and looked at some code to see what the form was called.

Logging in, it balks at ptrsafe in ModHideClose and I'm on 32 bit windows.

Thank you.

@Ridders I can open every form in design view except frm_home.
Seems it was 64 bit code?
 

isladogs

MVP / VIP
Local time
Today, 13:21
Joined
Jan 14, 2017
Messages
18,219
It works perfectly for me in 32-bit Access 2010.
Does it work for you if you alter the APIs to remove the three PtrSafes?
 

Gasman

Enthusiastic Amateur
Local time
Today, 13:21
Joined
Sep 21, 2011
Messages
14,288
Colin,
I tried commenting out the whole Private Declare and then uncommented it and removed the ptrsafe keyword.?

Same result when the code went to open frm_home

Please see attachment.

Not to worry, I got the gist of it from the link UG posted.

I have a question though. This is all to speed up the loading of frm_home I believe.?

So as one would select a tab control the subform for that tab is loaded. If the design was left with actual tab controls and each subform control on each tab was populated as and when thei parent tab was clicked, would we not be able to leave it loaded, when we switch to another tab and so if switching back to an already loaded tab, that data would already be there.?

I do appreciate that the tab header and one subform control would be a better option though as along as one did not need to refer to any of the controls on the other tabs?
 

Attachments

  • test.PNG
    test.PNG
    6.4 KB · Views: 125

Users who are viewing this thread

Top Bottom