473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Prevent Filtering and Sorting with Subform Controls?

Hello,

I have some specification sheets with subforms I have created. I'm having a problem where if you right click and filter/sort any field in the subform (which is tied to the main form in a 1:1 relationship), then the subform only displays the first record. This ends up permanently altering the spec sheet. I notice that when this happens, text typically shows up in the "Order By" or "Filter" fields of the subform. My only resort is to delete the broken spec sheet and subform and then reimport them from a backup version of the database.

Is there some way to prevent the user from filtering/sorting fields in the subform? I tried setting the "Allow Filters" property of the subform to false but this does not fix it since users can still right click and sort. The only thing I can think of is preventing users from right clicking on controls in general, but then they can no longer right click on any of the other forms (where filtering and sorting is important) which is not preferred. Any suggestions?

For some background, here is the layout:

Form <Form Main Body>
RecordSource = qryI^^INSTRUMENT_BASE
(User navigates through records on the main form)

Form <Linked Subform>
RecordSource = qryI^^INSTRUMENT_HEADER
Link Master = INSTRUMENTID
Link Child = Instr2Body
(Not allowed to navigate through records in the subform due to 1:1 relationship)

Query <qryI^^INSTRUMENT_BASE>
[INSTR-INDEX_HEADER] Type 1 joined with [INSTR-INDEX_BASE], [Instr2Body]-[INSTRUMENTID]

Query <qryI^^INSTRUMENT_HEADER>
[INSTR-INDEX_BASE]

Table [INSTR-INDEX_HEADER]
[Instr2Body] - Primary Key, integer

Table [INSTR-INDEX_BASE]
[INSTRUMENTID] - Primary Key, integer

Macros run when the instrument (Instr2Body) is selected in the header, which simultaneously fills in a hidden control box for INSTRUMENTID then refreshes the form to create the specification sheet. All controls in the body section are disabled if the spec sheet is new to prevent creating the spec sheet in the wrong location.

Thanks in advance for the help.
Jan 7 '11 #1
5 7064
I know my question was rather long, but all I'm wanting to know is how to prevent the user from right clicking on a form and sorting or filtering the data in it.

Does anybody know how to do this or can it only be done with a global right click disable?
Jan 13 '11 #2
Figured it out (about 10 months later :S ) Apparently if you have Access 2007, customizing right click menus (Shortcut Menu) either involves code, or you have to open it in Access 2003 and customize the menu from there. You can then pick the shortcut menu for Current Database or for Form Properties.

In Access 2003, you go to View, Toolbars, then Customize. Select the Toolbars tab, then create a new menu. Click properties, then from the Type dropdown list, pick "Popup". After that, go back to the Toolbars tab, then check "Shortcut Menus" to get the entire list of all menus. Custom menus appear on the very right hand side. You have to drag commands from the predefined trees over to your custom menu's tree.
Nov 14 '11 #3
NeoPa
32,556 Expert Mod 16PB
Have you tried setting the Allow Filters property to No? It would be a sensible first step.

You state that such filtering selections change the original design of the form such that when it's re-opened the filter is already set, but this can only happen if you save the form when you close it. If you choose not to then the original, of course, is kept. If you get no such prompt then this indicates you have Warnings turned off permanently, which is never a good idea. Run the following code to fix this :
Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.SetWarnings(True)
Nov 16 '11 #4
Yes, I saw the Allow Filters and set that to "No", but I was still able to right click and say "Sort ascending/descending". Basically if these subforms had any field filtered or sorted, the entire record would become unlinked with the parent and would be broken. The form was kind of a Frankenstein and it basically has records created from the subform by selecting a tag within it.

Also, warnings were turned on.
Nov 16 '11 #5
NeoPa
32,556 Expert Mod 16PB
JBrumbau:
Also, warnings were turned on.
In that case saving of the form would have been prompted. If you. or anyone else you allow to have write access to your database, closes the form and accepts the prompt to save then the form will be saved in what would be considered its temporary state. If this had not been done then no changes would have been saved and the form would revert each time to the originally intended design.

The Allow Filters property would not disallow sorting the data. Your other found solutions for changing the interface would be required for that. My advice would always be to do it in such a way that you make sure any such changes effect only your own specific database though. Users won't thank you for interfering with their Access application generally.
Nov 16 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: MLH | last post by:
I have created two forms: frmBrowseNegsMainform and frmBrowseNegsSubform. I put a subform control on the first of these. The SourceObject property for the subform control is, of course,...
3
by: Todd | last post by:
Hi, I've been told in another forum that I can apply a filter to a subform (from a control on the main form) by using the following code: Me.sfrMySubform.Filter = " = 7" I've tried this...
0
by: Lauren Quantrell | last post by:
In terms of resources, wondering if it makes a difference in adopting one of the three options below for resizing controls on a form and controls on a subform at the same time. option a.) Put...
5
by: LDD | last post by:
Hi Folks I'm trying to determine a way to handle paging, filtering and sorting in a datagrid. If I choose to filter and sort, I'd like to return a subset. If that resultset has more records...
25
by: hjozinovic | last post by:
Hi! I have a MainForm and a SubForm on it. They're linked and can be filtered, sorted etc... I designed MainReport and SubReport that should match filter and sort criteria from MainForm and...
8
by: BASSPU03 | last post by:
I'm using Access 2003 on a Windows XP O/S. I've made two copies of Form1 so that there're are 3 forms: 1) Form1 2) Form2 3) Form3 Essentially, they all write to the same Table1.
2
by: kbaisch | last post by:
Can someone help me with the syntax? I want to sum the hrs for each dept, name & ppe. Any help given will be much appreciated. Thanks in advance. Dept_# Name PPE Hrs 533 Empl Name 4/15/2006 0...
3
by: cwby1966 | last post by:
Hi I have a main form with a subform. The mainform has 2 textboxs Starting date and ending date. These are for the user to select a date range, and then clicka button to filter the subform to view...
4
by: OzNet | last post by:
I have a form with a subform and I need to filter the records in the subform by dates. (Access 2007) The main form has two unbound text boxes called StartFilter and EndFilter. Both use the...
5
by: gershwyn | last post by:
I'm trying to make a very simple order form. I have two tables - OrderHeader has information specific to the order itself, such as company name and order date. OrderDetail contains details such as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.