If field 1 = "100" then

R

Rick B

Why? You can simply test for field 1 in your queries reports and forms.
This is like storing a calculated value in your table. It is normally not
done.

What is "field1" What is "field2"? What if you change a record (through a
query) and set field1 to "100", your field 2 would not get updated by that
query.
 
O

Ofer

On the after update event of field1 write the code

If Me.Field1 = "100" then
me.Field2 = "2"
End if

But if it's a field that the user never change, write in the contril source
of the field2
=IIf([Field1] = "100",2,0)
Don't store this value in the table
 
S

SharonInGa

Better explanation this round: What is the code for the following:

Field 1 = locationID
Field 2 = VendorID

if location(field1) = "100", "200" or "300" then populate VendorID(field2)
with the ID number of "2"

else

VendorID = "3"
 
O

Ofer

On the after update event of field1 write the code

If Me.Field1 = "100" Or Me.Field1 = "200" Or Me.Field1 = "300" then
me.Field2 = "2"
Else
me.Field2 = "3"
End if

But if it's a field that the user never change, write in the contril source
of the field2
=IIf([Field1] In ("100","200","300"),2,3)
Don't store this value in the table
 
S

SharonInGa

Thanks, I used your suggestion and it worked. The next step is to insert
an sytem generated ID instead of hard code for the updated field 2.
 
Top