Avatar of Patrick O'Dea
Patrick O'Dea
Flag for Ireland asked on

Add - Modify Data

Hi,

General high level question. (Must have arisen before).

I have simple table for "Supplier Details".
The data is UniqueSupplierCode, Name, Address, Email etc.

I want a SINGLE form which will allow me to Add new suppliers and modify existing ones.
How can I prevent the user from amending the UniqueSupplierCode once it has been set up.
They can obviously amend the name and address details etc.

I do not want to use autonumbering.

Microsoft Access

Avatar of undefined
Last Comment
Patrick O'Dea

8/22/2022 - Mon
Rey Obrero (Capricorn1)

lock the control that display the UniqueSupplierCode
Patrick O'Dea

ASKER
Thanks capricorn1,

But if I lock the control then I will not be able to add NEW suppliers ??  true?
Scott McDaniel (EE MVE )

You can toggle the control to allow edits based on the NewRecord value. You'd do this in the Current event of the form:

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

This will Enable and Unlock your control when the form is in the "NewRecord" mode only.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Patrick O'Dea

ASKER
THanks LSM,


a perfect solution!
Patrick O'Dea

ASKER
oops, I thought I had closed this query and have since raise another query that relates to this one.

...The solution is not as perfect as I thought !

I need to be able to filter and sort on the data that is disable by this code;

 Me.YourControl.Locked = Not Me.NewRecord


Anhy easy way to do this??
Scott McDaniel (EE MVE )

Whether the box is locked or enabled would have no impact on the Filtering, unless you're referring to the rightclick filter.

⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Patrick O'Dea

ASKER
yes , I am referring to the right click filter.

What is the best (simplest) way to get a filter on this field??
Can I re-activate my right click one??
ASKER CERTIFIED SOLUTION
Scott McDaniel (EE MVE )

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Patrick O'Dea

ASKER
Got it now!


Thanks again