In this situation, the table being looked up is "tbl_key_codes." The field the value is being plucked from is KEYCODE, and a field by the same name on the form will inherit this value (the code is assigned to the "on enter" event procedure of the form's field). At the same time, a field in this table named "used" will be set to TRUE. The condition: the value in the table's field named PRODUCT must match the contents of the field by the same name on the form--also, the value in the table's field named "used" (mentioned before) must be equal to FALSE.
Me.keycode = DLookup("[keycode]", "tbl_key_codes", "[product] = " & strQuote & Me.product & strQuote & "AND [used] = NO")Again, a summary of the scenario
Table Being Looked Up | tbl_key_codes |
Field on Table Being "Plucked" From | keycode |
1st Condition | Table's Field PRODUCT must equal Form's Field PRODUCT |
2nd Condition | Table's Field USED must equal FALSE |
Also see: update queries