Solved

Locking a table

Posted on 2006-06-27
12
409 Views
Last Modified: 2012-05-05
is it possible to lock a table after adding 1 record so that no other records can be added? i am using fm8 with xp.
i have set the layout to not save records i have also created a custom menu so that add record is not available.
is this basically the only way to do it or is there another more fool proof way of locking a table?
0
Comment
Question by:kauakea
  • 4
  • 4
  • 4
12 Comments
 
LVL 28

Expert Comment

by:lesouef
ID: 16999031
not to save record in a layout means, not automatic and asks confirmation, but does not mean cannot be saved.
if no script to create a new record + menu command removed, that's enough.
the fullproff way to do it is to remove records creation privilege in the account rights, and have a specific account to create it; but if it is the same user who is supposed to create the new record and then being disabled, you can't use that unless you relog the user under another name in a script after record creation... a bit hairy...
0
 
LVL 19

Expert Comment

by:billmercer
ID: 17006307
If you want to allow the user to create only one record, but no more, you can do this by adding a field that can only have a single value.

Create a new field, and give it an auto-enter value that is a constant, such as 1.
Then set validation for the field to require unique value (no duplicates), and specify that this validation is performed always, not just on data entry. Set the field to prevent modification, also.

You can also add a custom error message to the validation that explains that you cannot add any more records

Now, if the table is empty, you can create one record.  But if you try to add a second record, the field validation won't allow it because you already have a record with that value, and you'll see an error message.
0
 
LVL 28

Expert Comment

by:lesouef
ID: 17007040
btw can we know the purpose of this? a table for only 1 record? if it 1 record per user, then it should be in the users table for instance...
0
 

Author Comment

by:kauakea
ID: 17011825
i am setting a database up with about 50 forms. i want to use 1 layout for each form and just pull the fields from a record to fill in the fields. however there is no need to save the forms once they have been generated because once they are sent out that is the last that they will be accessed.
0
 
LVL 19

Expert Comment

by:billmercer
ID: 17011992
I've occasionally used a single-record table with FM Server as a way to implement truly global variables that are persistent and shared by all users. That's a legitimate reason for doing something like this, but if you don't plan to keep the values, then it might be simpler to just use a set of global fields instead.


0
 

Author Comment

by:kauakea
ID: 17012300
how do you mean use a set of global fields. i have set up each of the tables that hold the form layout field information as global. i actually have about 120 forms but many of them share the same layout via setting the form fields through a script. but since the forms differ in appearance and the fields dont layout the same on all of the forms i couldnt see how to further narrow the number of form layouts
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 28

Expert Comment

by:lesouef
ID: 17013299
depends on the forms, sometimes, you can make them all with very few layouts by doing a large use of merge fields, merging say 50 fields in a single text field with represents the whole page
0
 
LVL 19

Accepted Solution

by:
billmercer earned 500 total points
ID: 17013912
I was just referring to using global fields instead of a separate table with a single record, not the number of layouts in your files. I don't know how your database looks, but if you had, for example,
  FirstName
  LastName
  Company
  City
Then you could create global fields called
 gFirstName
 gLastName
 gCompany
 gCity
and set their values with a script, instead of having to create a separate table to hold just one record.
Unless you're using an older version of FileMaker, where each file is a separate table?


 
0
 

Author Comment

by:kauakea
ID: 17013938
Actually, that is what i have. i should have clarified. i do have 3 tables that the layouts are bases on with all global fields that i set with the script at the time of form selection
0
 
LVL 19

Expert Comment

by:billmercer
ID: 17014670
If the fields are all global, then it shouldn't matter how many records are in the table.

If you just want to keep people from adding records to this table for neatness, then just hide the options to create records.

If you really want to prevent anyone adding another record, you can enforce it with field validation as I mentioned above, but for novice users, it might be simpler to just ignore the whole issue. If someone somehow manages to create one anyway, it won't hurt anything, since the global fields won't be affected.

You could create an "initialize" script that deletes all records, then creates a new one and populates it with any desired values, then set the file to run this script automatically when opened.
 
0
 

Author Comment

by:kauakea
ID: 17014722
i like the initialize script idea...it seems to be the answer.... keeps it clean and free of all worry!!! thanks
0
 
LVL 28

Expert Comment

by:lesouef
ID: 17015871
you could even delete the created record right after printing.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?" An…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 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

14 Experts available now in Live!

Get 1:1 Help Now