Solved

Filtering not allowed ..

Posted on 2011-03-09
5
387 Views
Last Modified: 2012-05-11
Hi,
See code below.
This was a very helpful response I got to an earlier query.
It prevents the user from changing data unless it is a new record.

Unfortunately, it is also preventing the user from filtering and or sorting this data.
Is it possible to prevent change but allow filter (preferably by using something similar to the code below?

Sub Form_Current()
  Me.YourControl.Enabled = Me.NewRecord
  Me.YourControl.Locked = Not Me.NewRecord
End Sub

Open in new window

0
Comment
Question by:Patrick O'Dea
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 75
ID: 35088957


Sub Form_Current()
  '  Me.YourControl.Enabled = Me.NewRecord     ' take this out - Enable the Control ... then just Lock it.
  Me.YourControl.Locked = Not Me.NewRecord
End Sub

mx
0
 

Author Comment

by:Patrick O'Dea
ID: 35089099
Sorry databaseMX,

I should have mentioned..

I need to be able to enter data for NEW records - therefore I cannot lock the control.

Background: I am setting up a supplier table.  I need to be able to add supplier codes.  However, once they are added they cannot be changed.  I do not want to use auto numbering.

When I open a continuous form of 1,000 suppliers I want to be able to filter on these codes (but NOT change them).
 
0
 
LVL 75
ID: 35089124
Are you talking about using the built in Right Click Sort / Filter options - on that Text box ?

mx
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 35089153
"I need to be able to enter data for NEW records - therefore I cannot lock the control."

Well .. your original code still handles that

Sub Form_Current()
  '  Me.YourControl.Enabled = Me.NewRecord     ' take this out - Enable the Control ... then just Lock it.
  Me.YourControl.Locked = Not Me.NewRecord
End Sub

Not sure I see where the issues is ... ?  As long as the control is always Enabled, you can click into or over it ... and Right Click and Filter / Sort ...

mx
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 35089364
All works fine now.

I am not 100% sure why but I will figure that out tomorrow.

Thanks again.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question