Type or scan with a bar code scanner? both?
What does this accomplish for you?
A basic script can be set up with a button or script trigger that searches a database table for records with the entered data and it can certainly set a field to "yes" if at least one such record is found but what does that "yes" represent? Do you need the "yes" retained or should the same field update with each search?
Assuming you just need "yes" to appear as long as matching info exists in the field, this approach, which does not use a script, may serve:
Define a global field for your input field, called gInput, for this example. Define a relationship like this:
Table::gInputField = Products::ProductID (assuming ProductID is the name of the field that has the matching data)
Use the layout text tool to type "Yes" next to gInputField. Right click it while in layout mode and specify Conditional Format.
Add this Conditonal Format Formula: IsEmpty ( Products::ProductID )
Specify a font size of 500 for this conditional format.
Now, when you enter or scan the ProductID into this field, "Yes" will automatically appear if it matches a record in the Products table. If it does not, the text disappears.
I need the YES entered into the field of that record. So at the end of the day, i can print out a report of all the items that do not have a YES in the INVENTORY2011 field.
It's a start.
What tables do you have defined in your database? How are they related?
Do you have one record for each item in inventory or do you have one record for type of item. (If you had 10 shovels in invetory, would you have 10 records or one record with 10 in the quantity field?)
Note: Since you'll take inventory again in 2012, a solution that does not rely in a dedicated field for each year's inventory will be much more flexible.
In your example, i have 10 record with 10 shovels. They are barcoded 000001 - 000010
Do you have just the one table?
I'd use one table to list my items and a second table to record my inventory counts--with a field to record the date or at least the year that the count was taken so that I can use the same set of fields for multiple inventory counts.
This results in two tables linked by your ID field:
Products::ProductID = InventoryChecks::ProductID And
Products::gYear = InventoryChecks::Year
Each Time you confirm that an item is present, you create a record in InventoryChecks. Your report will be a list of all record in Products that do not have a matching record in InventoryChecks.
Enable "Allow creation of records via this relationship" for Inventory Checks
Define gYear as a field with global storage.
Define gInputField to have global storage in Products.
Create a layout based on Products and place gInputField on it.
Run this script after entering the ID number of a product:
Enter Find Mode //clear the pause check box
Set Field [ Products::ProductID ; Products::gInputField ]
Set Error Capture [on]
If [Get ( FoundCount ) // a record was found with this ID]
Set Field [InventoryChecks::ProductID ; Products::ProductID] (this creates a record in InventoryChecks with this ID and the value in gYear)
Show Custom Dialog ["Item not found"]
before using this script, select the current date in gYear. Then start entering ID numbers and running the script to log them in InventoryChecks.
To produce your list of items not yet checked...
Add a list or table view layout based on products. Include the InventoryChecks::ProductID field on this layout.
Enter Find mode
Enter an * in the InventoryChecks::ProductID field.
Click the Omit button in the status area
Perform the find.
This manual search can be scripted.