?
Solved

Filtering not allowed ..

Posted on 2011-03-09
5
Medium Priority
?
391 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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Suggested Courses

777 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