How to create a validation rule which restricts data entry from specific table - validation

I am creating a data entry form and report on MS Access and I would like to create validation rules for some input text boxes that restricts data based on the data contained in another table.
For example: For the subdivision input field, data that can be entered must be equal to one of the items which is contained in the Subdivision table which contains a list of subdivisions such as:
Los Angeles Sub
San Bernardino Sub
Riverside Sub
Etc
How would I go about doing this?

If your form data is directly bound to the table that holds it, then you would use the Before Update event of each text box to perform any validation you wish using VBA. If your form is not bound directly to the table you can either use the On Lost Focus event to validate each text box individually or whatever process you use to push the data to the table and validate the entire form input.

Related

using an input field in FileMaker that is not related to any table?

I'm in need of entering a few data points in the UI of a FileMaker app that are used either for search or for computation, but that have no relation to any field in a database (and don't need to be saved). So I want to add an input field without having it tied to a table field, and it seems that's something FileMaker just doesn't do.
Two use cases:
a) I want a custom search/filter interface instead of using the FM one. My users should see two calendars, pick two dates and the data is filtered by those (between them), as well as additional criteria, which don't directly translate to field searches. I know I can use "startdate ... enddate", but I'd like a more user-friendly interface.
b) Users enter a few data points into seperate fields which are then computed and combined into one database field by script. This is technical data that is entered by copy-and-paste and needs a bit of parsing before I put it into the database. Again, I'd like a field that isn't related to the database, put a script trigger on it, and when data is entered there, it is parsed and put into the actual DB fields.
Is it possible at all to have input fields not related to a database in FileMaker ?
If not, what's the best practice? I thought about setting up a dummy table with various fields I can use, but maybe there's a better way?
You should read up on global fields. They can be in any table and are accessible from all tables. They do not retain their value after the session is closed if the file is hosted. Use a script to perform a search based on what the user types in the global field.

HOW TO INSERT RECORD IN DATA BLOCK ON ORACLE FORMS

I have oracle form which contains data block B_ITEM which refers database table master_item. The User is entering two items in one bill manually in data block and based on certain conditions I need to add freight item in same block B_ITEM automatically. could you please guide how to insert data in data block. (Note:I don't want to insert directly in table which it refers)
Step-1 Created a canvas on date block on B_ITEM where user can give provide input. Block
contains field item from master_item table.
Step-2 Lets Say, User entered two items on canvas which refers B_ITEM and click on ok button.
Step-3 So along with two items, one more item should get inserted in block B_ITEM and it should display on canvas on 3rd line.
In the above image, I have shown example of single item, so once user clicks on OK button 2nd item should get added based on setup table.
MASTER_FREIGHT_LINK
ITEM FREIGHT_ITEM
101396306 101396307
So, In canvas freight item should added on second row as soon as user click on OK button by entering ITEM-101396306.
I don't quite understand what you have, so - let me think aloud.
there's a table in the database, called MASTER_ITEM
you created a form whose block B_ITEM is based on the MASTER_ITEM table
data block contains some items which are, I presume, database items (that belong to the MASTER_ITEM table)
you enter some data into those items
based on their values (i.e. a certain condition), you'd want to populate FREIGHT_ITEM which resides in the same block, but is not a database item. Is that correct?
If that's so,
create the FREIGHT_ITEM (there are several ways to do that; a simple one is to use the vertical toolbar's + button; or, copy/paste one of existing items and modify its properties)
create WHEN-VALIDATE-ITEM trigger on items that should decide which value should be put into the FREIGHT_ITEM. Put the condition you mentioned into the trigger code and populate FREIGHT_ITEM's value, e.g.
if :b_item.item1 > 100 and
:b_item.item2 = 'A'
then
:b_item.freight_item := 42;
end if;
Now, as you said that you don't want to store that value into the database directly (which means that it is not a database item), you'll have to do it manually, creating additional ON-INSERT and/or PRE-INSERT and/or PRE-UPDATE trigger, which will do that as
update master_item i set
i.freight_item = :b_item.freight_item
where i.some_id = :b_item.some_id;
ON-INSERT trigger can be used to override oracle forms insert mechanism. Write in the on-insert trigger the insert statements necessary, which can insert data on any table.

Data structure to show postal code on selecting city

I have a table with three fields-
Postal code
City
Suburb
Each row has a unique combination of these three columns. On the front-end I have an address form where I want to show the list of postal codes when the user is typing the city name. Something like this-
The table has around 30,000 entries so I can't hit the database everytime the user adds an alphabet. I want to store the entire table in a data structure when the form page loads and then retrieve the relevant rows everytime an alphabet is added in the city box.
What is the data structure that I should use to save the entire table in the JVM when the page loads?
Why not a Hash Map with keys as city names, and values as a string concatenating all the three fields (which is ultimately what has to be sent to the browser)
This map can be pre populated at startup

Google Forms: Autofill fields based on data from external database

Basically what I'm trying to do is create a form with fields that are autofilled (such as name, address, email etc) based on info in the first field of the form (social security number). All data is stored in an external MySQL database.
So when I manually enter a SSN in the form, I need some kind of script to run and check the database for the corresponding values associated with the SSN, and autofill these values into the corresponding fields in the form, and if the SSN is not found in the database it should let me fill out the fields manually.
not possible with google forms which does not support running code at form fill time.
instead write a webapp with appscript or appmaker.

Validation of Data in datasheet mode--access 2007

Users are PASTING data into a form in DATASHEET mode, so many records are being entered at the same time. For a specific field called ID, I need to validate the ID against another table. In the sense that the IDs they enter should be already available in another table. Drop down box, selection is not possible.
I also need to return the values that are not VALID
What kind of SQL statment or VBA or validation rule should I use?
"In the sense that the IDs they enter should be already available in another table" - you need an event to trigger the check, so perhaps have them enter into a datasheet on a form rather than a back end table then you can use the various on-changed events, search online for them. In that event simply run a one-to-one query. To return "return the values that are not VALID" you simply need an unmatched query, again, search for info, it's widely documented.

Resources