Field updated instantly
Field updated instantly
(OP)
Hi,
It's the second time I ask this, but this time I've put a more descriptive subject!
I've 2 fields : the area_ID and the Surface. They are both in the same table (tblArea).
So, when user enter the area, in the AfterUpdate event I write the following code to updated the field Surface instantly:
Private Sub area_ID_AfterUpdate()
[Surface] = DLookup("area_surface", "tblArea", "area =[area_ID]")
End Sub
The Surface should appears in the surface field of my form, no? What's wrong with this code? Is this the good way to make it?
Any help is welcome,
Cantor
It's the second time I ask this, but this time I've put a more descriptive subject!
I've 2 fields : the area_ID and the Surface. They are both in the same table (tblArea).
So, when user enter the area, in the AfterUpdate event I write the following code to updated the field Surface instantly:
Private Sub area_ID_AfterUpdate()
[Surface] = DLookup("area_surface", "tblArea", "area =[area_ID]")
End Sub
The Surface should appears in the surface field of my form, no? What's wrong with this code? Is this the good way to make it?
Any help is welcome,
Cantor
RE: Field updated instantly
your field names are "area_ID" and "Surface"
then your code should be
Private Sub area_ID_AfterUpdate()
Me.[Surface] = DLookup("Surface", "tblArea", "(tblArea.area_ID) = [forms]![YourFormName]![area_ID]")
End Sub
just change the red to reflect your form name. this is assuming your fields have the same name in the table as they do on the form.
Brian Famous
bfamous@ncdoi.net
RE: Field updated instantly
it works and makes me happy! :)
Cantor