Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / May 2008

Tip: Looking for answers? Try searching our database.

Custom Menu

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
terri - 12 May 2008 22:19 GMT
Using 2000RT, I have a number of dynamic queries that I need to display in
datasheet format for review only.  Using DoCmd.OpenQuery "xxx", acViewNormal,
acReadOnly does the display just fine, however, my custom menu is replaced by
the standard Access menu until the query window is closed.

Is there a way to assign a custom menu to this window?  Or, as an
alternative, is there a way to make the window behave like a modal window
with no menu access?

Thanks.
---
terri
Jeanette Cunningham - 12 May 2008 23:02 GMT
terri,
use a form to display these queries as a datasheet.
In the form you can specify which menu to display while the form is open.
Queries have very limited use for showing data to users - they are designed
to do all the work behind forms - not to show data to users.

Jeanette Cunningham -- Melbourne Victoria Australia

> Using 2000RT, I have a number of dynamic queries that I need to display in
> datasheet format for review only.  Using DoCmd.OpenQuery "xxx",
[quoted text clipped - 10 lines]
> ---
> terri
terri - 13 May 2008 06:11 GMT
Thanks for replying Jeanette.

I had initially thought to use a form, but these queries are pivot tables
that return a variable number of columns.  I got awfully close to making it
work:

1. In the form, I placed an unbound textbox for each of the maximum number
of columns that could be returned.
2. I save the results of the query to a table.
3. In the form’s Open  event, I cycle through the Fields collection, setting
the controlsource for each of the textboxes that should be visible and set
the ColumHidden to true for the unused controls.
4. I set the recordsource to the table.

The form opens in datasheet view just dandy.  However, the column headings
reflect the control names – Text0, Text1, Text2 – not the field names.  This
obviously makes the display useless!

Is there a way to programmatically set the datasheet column captions?
Signature

terri

> terri,
> use a form to display these queries as a datasheet.
[quoted text clipped - 18 lines]
> > ---
> > terri
Jeanette Cunningham - 13 May 2008 06:21 GMT
terri,
the column captions will take their names from the textbox controls.
Can you cycle thru the fields collection and set the each txtbox to the
appropriate field name?
When you set the control source for each textbox, set the name of the text
box as well.

Jeanette Cunningham -- Melbourne Victoria Australia

> Thanks for replying Jeanette.
>
[quoted text clipped - 45 lines]
>> > ---
>> > terri
John Spencer - 13 May 2008 13:41 GMT
How about using a subform on the form?
You can set the subform's Source Object to a query.

  Me.sfrmDisplayData.SourceObject = "QUERY.Display_Results"

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County

> terri,
> the column captions will take their names from the textbox controls.
[quoted text clipped - 54 lines]
>>>> ---
>>>> terri
terri - 13 May 2008 14:17 GMT
That worked perfectly.

Thanks John!!!
Signature

terri

> How about using a subform on the form?
> You can set the subform's Source Object to a query.
[quoted text clipped - 64 lines]
> >>>> ---
> >>>> terri
terri - 13 May 2008 23:58 GMT
John,

Swapping out the queries as the SourceObject worked great -- until I got to
one that has a parameter that references a value of a control on the calling
form.  The subform doesn't display because the object "is closed or doesn't
exist."

Since this query happens to return a set number of columns, I worked around
this by creating a separate subform.  The parameter value is the only
dynamically named column in the pivot, so I set the controlsource of the one
unbound control (and the window caption) to this value and set the
recordsource to the query in the subform Open event.  In this one case, I set
the SourceObject to the subform instead of the query.

This works -- but I'm curious as to why the parameter cause this... any idea?
Signature

terri

> How about using a subform on the form?
> You can set the subform's Source Object to a query.
[quoted text clipped - 64 lines]
> >>>> ---
> >>>> terri
terri - 13 May 2008 14:01 GMT
The control's name property can only be changed in design -- not at runtime.
Signature

terri

> terri,
> the column captions will take their names from the textbox controls.
[quoted text clipped - 54 lines]
> >> > ---
> >> > terri
Albert D. Kallal - 13 May 2008 01:21 GMT
I like the other posters suggestion to actually build a form or report to
display this data.

However, if you specified your custom menu as the main application menu at
startup (tools->startup), you should see just your custom menu bar. In fact,
for any form or report that you haven't specified a menu bar, you'll see the
main default menu bar that you've specified in your application. It is quite
likey this is NOT not the effect your looking for. (but it would show your
custom menu bar when viewing a query however).

> Is there a way to assign a custom menu to this window?  Or, as an
> alternative, is there a way to make the window behave like a modal window
> with no menu access?

You can see that you don't have any settings like menu bar settings, modal
settings, popup settings etc. This "lack of" list goes on for a long period
of time and you have virtually NONE of these settings and options when
viewing a query (this means they're not intended to be used by end users of
your application).

Thus, you need to consideer a datasheet, some type of continuous form, or
perhaps better even a report.

It's considered a poor design practice to open up a query for your end
users. That simple query view has no way of verifying the data, no before
update events, virtually nothing to aid you in testing and checking what the
user enters into that table view to ensure that the data entry is done
correctly.

Signature

Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com

terri - 13 May 2008 06:11 GMT
Thanks for your response.  Setting the default menu (along with a little
tweaking) will allow me to do what I need.

BTW -- these queries are read only – not for data entry.  They provide
summary statistics in pivot tables.
Signature

terri

> I like the other posters suggestion to actually build a form or report to
> display this data.
[quoted text clipped - 24 lines]
> user enters into that table view to ensure that the data entry is done
> correctly.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.