Quic question - Field verification on a Form

  • Thread starter Thread starter luis.a.roman
  • Start date Start date
L

luis.a.roman

I have a form that I need to update a field depending on the previous
value of that field. Because I have the field in the form with the new
value. is there any away that I can check the field value prior to the
change?

I would like to read the table and retrieve the field and check value.
But not able to figure out how to do that?

Suggestions please . I'm stuck.
 
Luis - this might get you headed in the right direction:

In the before update property of the field, you can capture the old
value...

(replace FormName with the real form, and test with the name of your
field...)

Dim vOld As Variant
vOld = Forms![FormName]![test].OldValue
'do this only if the value on the form before this entry was
different>>

If Me!test.Value <> vOld Then
'do whatever you want to do here - the value of the field is now in
the variable vOLD
'(I'm using a variant in case the field was null)
End If

If you need to do something with both the old and the new value after
the update takes place, modify this code so that the old value goes in
a global form variable.

Cindy
 
(I said name of the field - should have said name of the control.. if
the field name and control name are different, use the control name).
Luis - this might get you headed in the right direction:

In the before update property of the field, you can capture the old
value...

(replace FormName with the real form, and test with the name of your
field...)

Dim vOld As Variant
vOld = Forms![FormName]![test].OldValue
'do this only if the value on the form before this entry was
different>>

If Me!test.Value <> vOld Then
'do whatever you want to do here - the value of the field is now in
the variable vOLD
'(I'm using a variant in case the field was null)
End If

If you need to do something with both the old and the new value after
the update takes place, modify this code so that the old value goes in
a global form variable.

Cindy


I have a form that I need to update a field depending on the previous
value of that field. Because I have the field in the form with the new
value. is there any away that I can check the field value prior to the
change?

I would like to read the table and retrieve the field and check value.
But not able to figure out how to do that?

Suggestions please . I'm stuck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top