"Patrick Finucane" wrote in message
news:29204c42-17a2-4575...@g21g2000yqc.googlegroups.com...
>Hi Albert:
>I was hoping you'd step up to the plate as you are one of the few in
>the whole wide world that understands Access 2010.
>
>Unfortunately, your response did not provide any examples. You kind
>of prove my point. Access 2010, the new and improved physics.
Sure there is few examples.
However then again this is a new feature.
This will take time for the general community to adopt use and get up to
speed with the new syntax of browse to.
I mean we have 18+ years of previous Access examples built up on the
internet – these things take time and comparing existing amounts of examples
to new features is really not fair at all.
On the other hand a lot of the community doesn't have to use the new system,
and is able to change the source object with standard VBA code anyway.
But lets try a few examples:
I mean, assuming a form called "Main" and we want to swap out a sub-form, we
can use with classic VBA:
Me.custChild.SourceObject = "formB"
Now of course you could use the new browseto and do the same thing with:
DoCmd.BrowseTo acBrowseToForm, "formB", "Main.custChild"
I not sure the people reading this care all that much about the second
example or not.
And heck I suppose we could code this without hard coding the form name
like:
DoCmd.BrowseTo acBrowseToForm, "formB", Me.Name & ".custchild"
So all 3 examples do the same thing;
We JUST changed the sourceobject of a sub from control on the form called
"custChild".
I think at this point, most will drift off and say "nothing to see here"
(and I quite much agree).
For those still reading and not sleeping (I hope!), then of course things
get a little more messy if you take your existing form and drop it inside of
an existing form.
However the real point here is we simply changing the source object of a sub
form control and that this is not a new concept to Access developers.
I mean if you are JUST looking to swap out a sub-form form and filter it
with some drill down and you are NOT needing or wanting the navigation
buttons to change automatic for you?
Then I see little need (or advantage) to use browseto. (it makes no sense).
The navigation system is really a replacement for your main menu or the
switchboard that so many of us lamented over the years.
So if you not needing to have navigation button choices "switch to" when
using "browseto" on a navigation form, then setting source object property
is a better choice in most cases.
If you need filtering, then use the link/master/child settings or even set
filter on the sub form object.
I even often set the sub-form recordSource
(so these are all common and long time approaches that we all used over the
years and should continue to use).
As noted, the only exception or case is when you do not have a CHOICE to
swap out sub-forms and you MUST use browseto (such a case is web based).
There are a few examples here:
http://blogs.office.com/b/microsoft-access/archive/2010/02/23/access-2010-browseto-docmd-and-macro-action.aspx
Also, if you want some more examples then just download some of the web
templates. They are a great source of examples. They quite much ALL have
browseto commands since for web based applications the SourceObject setting
cannot be used like in VBA applications.
However the syntax transfers over quite well to VBA. So if you are just
looking for some examples, you can use the web based ones.
So the use cases are:
You need/want the navigation buttons to "switch" to a new choice for you
when you use browseto.
The "nav buttons" with the name of the form specified becomes active when
you use browseto IF THERE is a nav button with the name of the form you
specified. (if not, then no navigation button highlight does not occur).
Web based:
You rather must use browseto since you as a general rule DO NOT want a new
browser window to open.
As a result, then in web you need browseto for not only filtering, but it
also enables use of the back button in your browser to return to previous
screen where as using openform in web based this does NOT occur.
For VBA based systems I most certainly suggest you use the new navigation
system to layout and stich together your application forms and dump the old
switch board.
However, for that of filtering a sub form in an existing form? Or even
swapping out a sub-form in a an classic VBA application?
Gee, I would continue to do this quite much the way the Access community has
done such UI setups for many moons.
Anyway, the above links gives some syntax examples, so do the templates - I
note most are web based, but that quite much he motivation for this.
Just remember that each form + sub form is like this:
FormName.SubForm
If you have another level, then you need another pair like:
FormName.SubForm>AnotherFormName.AnotherSubForm
So think of one form you specify as a pair.
I should also note one more great tip is that if you use browseto without a
subform, then your current form is closed and replaced - this is VERY useful
in web based, and I not come up with a use in VBA client based, but I do
often see some asking for the ability to close the current form and open a
new one - browseto can do this trick for you.
eg:
DoCmd.BrowseTo acBrowseToForm, "NewFormToOpen"
In the above we are NOT specifying a "MainForm.subform" pair.
For applications that use tabbed interface as opposed to overlapping
windows?
Well, you never know, but we could see a future in Access where browseto is
used as often as openform!
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
kal...@msn.com