If field 1 = "100" then

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
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"
 
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
 
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.
 
Back
Top