January 4, 200620 yr 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?
January 4, 200620 yr 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]
January 4, 200620 yr 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
January 4, 200620 yr 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)
Create an account or sign in to comment