Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field updated instantly

Status
Not open for further replies.

Cantor

Programmer
Apr 27, 2000
28
0
0
CA
Hi,<br>It's the second time I ask this, but this time I've put a more descriptive subject!<br><br>I've 2 fields : the area_ID and the Surface. They are both in the same table (tblArea).<br>So, when user enter the area, in the AfterUpdate event I write the following code to updated the field Surface instantly:<br><br><font color=red>Private Sub area_ID_AfterUpdate()<br>&nbsp;&nbsp;&nbsp;&nbsp;[Surface] = DLookup(&quot;area_surface&quot;, &quot;tblArea&quot;, &quot;area =[area_ID]&quot;)<br>End Sub</font><br><br><br>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?<br><br>Any help is welcome,<br>Cantor
 
if your table name is &quot;tblArea&quot;<br>your field names are &quot;area_ID&quot; and &quot;Surface&quot;<br>then your code should be<br><br><b><br>Private Sub area_ID_AfterUpdate()<br>&nbsp;&nbsp;&nbsp;&nbsp;Me.[Surface] = DLookup(&quot;Surface&quot;, &quot;tblArea&quot;, &quot;(tblArea.area_ID) = [forms]!<font color=red>[YourFormName]</font>![area_ID]&quot;)<br>End Sub<br></b><br><br>just change the red to reflect your form name.&nbsp;&nbsp;this is assuming your fields have the same name in the table as they do on the form. <p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
Thank you famousb<br>it works and makes me happy! :)<br><br>Cantor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top