Gotocontrol-how to find the source code (1 Viewer)

JMarie

Registered User.
Local time
Today, 12:13
Joined
Aug 15, 2015
Messages
19
Hi there,
I inherited a database that on it's main client page has navigation buttons (emergency contact/client notes/evaluation info/main client info(default page that opens when form is open)/etc. These navigation buttons will open and set focus to the specific subform. Each of the subforms will replace the view of the default subform.

The onlick event goes to vba with a simple docmd.gotocontrol.Clientnote
What I cannot find is where each gotocontrol had been defined. Clientnote may open a form called frm_clientnote, however, I cannot find anywhere a
dim clientnote=form!frm_clientnote type code.

Nor do I see any controls called Clientnote anywhere on the main or subform.
So I am a bit confused. If anyone can tell me where to look- thanks. (and hoping I haven't made it more complicated than it really is.)
 
Hi. We can suspect a few things but it might be faster if we can see the actual file. docmd.gotocontrol.Clientnote is not a standard syntax. Normally, it might look something more like this: docmd.gotocontrol "Clientnote"
 
can't help but think this is really about how a form gets loaded into a navigation form when the nav form tab is clicked. The gotocontrol method is for going to a field on the current record, no?
 
ClientNote will be a control on the form. If you open the properties window for the form in design mode, then choose that in the drop down list at the top, it will highlight the control on the form.
 
Hi all, Thanks for your responses.
theDBGuy- yes when typing I didn't catch that I had typed the syntax incorrectly.

Cronk thank you-- I never really used that drop down in that way. So it turns out this form has many pages and that is what is being called into focus with the gotocontrol command.
I never have used the pages before as most of the databases I've worked on use tabs. I like how seamless the pages make everything look and feel.

I appreciate all your help. I knew the control needed to be somewhere on the main form, but never showed up. Thanks to Conk- it highlighted where the pages sit on the form.
 
So it is just a subform control?
 
Yes (and no?)-it is similar to setfocus- you use it to go to a specific control, not necessarily subform.
In my case the main data page has the list of buttons (contact info/client notes/etc)
Each of the button sets the gotocontrol of the control on a different page or tab within the form. My form has 8 pages. And each page has at least one subform on it.

So in this case the gotocontrol actually was technically changing the tab on the form. What threw me was the original designer didn't leave it in the original tab format. She used buttons on the side of the main form instead of using the tab look. The pages of the tab were not distinguishable as they were stacked on top of each other with no visible tab. And the box defining the tab/page was not highlighted until conk mentioned using the top navigation bar- my main page in design view always just showed the first tab/page so I couldn't see the other controls. Does that make sense?
 
Last edited:
I'm not following what you mean
Could you show us two screenshots -form view and design view
 
I am having trouble envisaging that.:banghead:
Would it be too much trouble to upload that form in a DB for me to look at please?

No particular rush, just when you have a moment. I am keen to see what it looks like and how it works. No data required.

TIA
 
Yes- so sorry for the confusion-- basically the gotocontrol was used to go to a different page on a tabbed form. What threw me was that the look-- the person who designed it removed the tab look and instead used buttons for the user to tab through the different pages.
Because the tabs were missing I couldn't see all the pages when I opened it in design view- it defaulted to the first tab--hence I couldn't find the control!
And in design view the outline of where the tab page sat on the page was not visible until I took conk's advice. Does that make sense?

Once I used conk's advice I was able to go through each page on the tabbed form and see the name of the control.
 
No clearer. Screenshots please

BTW - Cronk with an 'r'
 
I made a database with just the form in it. When you open it you will get lots of 'can't be found' messages as I did not add any of the subforms.

Open in design and the default page will be showing. To see how the gotocontrol works go to the properties and in the drop down box click on any of the controls that start with "page". There are over a half dozen pages. The pages will then show by the outline of the tab form- and show any subforms on the chosen page.

These controls/pages are called from the buttons on the left.
 

Attachments

I'm sorry but by omitting all the other forms (or subforms?) as well as the table(s) relevant to the form, you've made it impossible to understand what's meant to happen when you click a button.
Effectively after clicking through endless messages I've got :
1. a form in design view (a screenshot would have been as useful)
2. Some code whose effects we can't see as it can't work in this version.
So you may as well have placed example code in the thread.
 
Isladogs,
The limit is 2mb for an upload of a database. There's no way I could put everything up there to run this and stay under that limit.

To get an idea of what the buttons do follow the directions I gave. In design view- Go to the properties drop down box and choose anything that begins with 'Page'.

Even in the design view you will see that as you click on the different controls (pageClientInfo, pageCourt, etc) a different page is showing- the look will be different- the subforms have different names, etc. But the outline of the page (tab) will stay the same.

Instead of calling it by clicking the button, you are calling it from its control name.
And if you look at the event code procedure on the buttons it's doing the same thing: This is the event procedure for one of the buttons:

Private Sub Command11_Click()
DoCmd.GoToControl "PageClientInfo"
End Sub

Does that make sense.
 
I had already done that but its not particularly useful.

This is what you should have done.
Removed most of the records from the tables used in this form and related items.
Included some or all of the missing subforms
Compacted and zipped your database
 
Colin, there's a tab control on the form with the tab pages' labels hidden.

There are sub forms (not included in the db) on different tab pages - hence the error messages. The buttons and the code are just a means of moving between tab pages.


Select the control TabCtl18 and set the Style property from 'None' to 'Tabs' to show the page labels.


IMO it's just extra functionality for no net gain but to each his own.
 
Thanks Cronk.
Returning to this in the morning, I've restored the tab control to show the tabs at the top and it now makes sense.
Personally I would show the tabs, move the tab control down below the rows of text boxes at the top (top=2cm) and shrunk its height accordingly.
 
Last edited:
Cronk,

Is there any benefit having the tab control overlaid over the controls in the detail band, as opposed to just having it below them, as I would have normally created the layout.

Colin, there's a tab control on the form with the tab pages' labels hidden.

There are sub forms (not included in the db) on different tab pages - hence the error messages. The buttons and the code are just a means of moving between tab pages.


Select the control TabCtl18 and set the Style property from 'None' to 'Tabs' to show the page labels.


IMO it's just extra functionality for no net gain but to each his own.
 
#isladogs
Personally I would show the tabs, move the tab control down below the rows of text boxes at the top (top=2cm) and shrunk its height accordingly.


Me too. I see screen real estate as having 3 priorities when displaying lots of data. Primary is what is to be shown all the time, secondary less important data on first page of tab control. Tertiary, on other pages of tab control.


The way it is set up is a sort of 'gotcha'. I get asked by clients to work on enhancing systems set up by others. Sometimes I find it's hard to fathom some obscure set ups such as this. I've learned to look for controls hidden or made minimal, such as subforms reduced to pixels to store data.



#Gasman
Is there any benefit having the tab control overlaid over the controls in the detail band,
Not IMO for the reasons above. But again, to each his own.
 

Users who are viewing this thread

Back
Top Bottom