Solved

Filtering not allowed ..

Posted on 2011-03-09
5
351 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
  • 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 - Access MVP) 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
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.

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now