Solved

Filtering not allowed ..

Posted on 2011-03-09
5
339 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 Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

758 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

21 Experts available now in Live!

Get 1:1 Help Now