Himitsu Posted January 4, 2006 Posted January 4, 2006 I have a table for company and I want to allow only one company to be entered therfore, only one record to be made. I started with making a serial field and trying to make a calculation that makes it unique and allowing only one number. But that doesn't work. How can you allow a number of records to be made in a table?
Zero Tolerence Posted January 4, 2006 Posted January 4, 2006 Just disable the users ability to add records through the menu. You can do this in Accounts & Privs. Then, make a button for them to create a record. In that button perform a simple If script. [if: Get(FoundCount) ≥ 1] [Error you cannot create a new record] [else] [create new record]
Raybaudi Posted January 4, 2006 Posted January 4, 2006 Hi Himitsu ok for unique validation of field CompanyName. ok for Zero Tolerance advice to disable users ability to add records through the menu. But for the script to attach to the "New Record" button, I think that is better this type: Set Error Capture [on] New Record/Request Show Custom Dialog ["Do you want to insert a new company ?";Companies:CompanyName] Commit Record/Requests[] If [Get(LastError)>0] Show Custom Dialog ["ATTENCTION"; "this company is already in the DB"] DeleteRecord/Request [No dialog] End IF
bruceR Posted January 4, 2006 Posted January 4, 2006 Don't use a script or calc. Just use a relationship where the "left" side of the relationship is an unstored calc = 1 and the right side is the record ID, set the relation to allow creation of related records. Don't provide access to the record on layouts based on this table (users could dup or delete or create new record)
Recommended Posts
This topic is 6962 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now