How to stop users from "unfiltering" a form?

  • Thread starter Thread starter Ryan Langton
  • Start date Start date
R

Ryan Langton

I have a form which I control the records filtered on using VB. Some users
are suppose to be able to see one group of records while other users can see
other records, there is criteria set up on Form_Load that checks their login
and shows them what they should see based on security settings. However, I
just realized that any user can easily remove the filter and see every
record in the database by clicking the menu item "Record -> Remove Filter".
This is not good. I've unchecked everything in the startup box so I don't
understand why they still have this level of control on the menu. How do I
stop them from doing this?

Thanks,
Ryan
 
Rather than using a view or the table as the records source, use a stored
procedure with parameters. This way, the form is not doing any filtering,
the server is. This has the added benefit of being much faster, as only the
data that you need is being sent across the network, rather than everything
and then your form filtering it.

HTH.
Jim
 
You must create Views or SP that will do the filtering on the SQL-Server.
 
In addition to the Views & SP's already mentioned, you can also dynamically
create a Select statement with Where clause as your record source. It's
essentially the same as creating a View, but can give you a bit more control
over the whole process.

In the On Open event, you'd simply have something like this:

Me.RecordSource = "SELECT * FROM <YourTable> WHERE <whatever your filter
is>"



Hope this helps,
Rob
 
You do get the default pop-up menus unless you
specify a different menu for the form.

(david)
 
I do have a custom menu displayed, it still shows the menu with
Filter/Remove on it though.

I fixed this problem by setting the Forms "Allow Filter" property to false.
This greys out the menu item for removing a filter but the VB code still
filters the recordsource. I could move all my VB filtering code to
Views/Stored Procedures but thats going to be a pretty big undertaking.
Perhaps if someday the database gets large enough to warrant the work, I'll
do it.
 
IMHO, the reason to switch to SQL Server and ADP is to utilize views and
stored procedures. It is important to understand that you have to think
differently when dealing with and ADP vs. MDB. If you do not change your
approach to match the technology, you will probably loose reliabilty and
speed.

Just my opinion.

Jim
 
The application was built from the ground up as SQL w/ADP. There are dozens
of server-side views, stored procedures, and functions that are used with
the program. The complexity of this particular query, however, surpassed my
level of knowledge and ability with T-SQL coding. It was just much easier
in VB.

Ryan
 
Back
Top