Solved

Add - Modify Data

Posted on 2011-03-09
9
219 Views
Last Modified: 2012-05-11
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.

0
Comment
Question by:Patrick O'Dea
  • 5
  • 3
9 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35087516
lock the control that display the UniqueSupplierCode
0
 

Author Comment

by:Patrick O'Dea
ID: 35087652
Thanks capricorn1,

But if I lock the control then I will not be able to add NEW suppliers ??  true?
0
 
LVL 84
ID: 35088414
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.
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

Author Comment

by:Patrick O'Dea
ID: 35088777
THanks LSM,


a perfect solution!
0
 

Author Comment

by:Patrick O'Dea
ID: 35088945
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??
0
 
LVL 84
ID: 35089090
Whether the box is locked or enabled would have no impact on the Filtering, unless you're referring to the rightclick filter.

0
 

Author Comment

by:Patrick O'Dea
ID: 35089122
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??
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 35089131
YOu can try Enabling the control and Locking it. Enabling it should allow you to interact with it, but keeping the Lock in place should stop people from updating it.

0
 

Author Closing Comment

by:Patrick O'Dea
ID: 35089368
Got it now!


Thanks again
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

820 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