Changing the value of one field based on the value of another field

Changing the value of one field based on the value of another field

Post by barrycron » Tue, 02 Oct 2007 11:23:44


I have two fields in my database 'driver' and 'loader'. As the driver
loads his own vehicle 80% of the time I want the value of the 'loader'
field to equal the value in the 'driver' field after the 'driver'
field is updated. I have tried a number of options in AfterUpdate but
without success. Can anyone help.
 
 
 

Changing the value of one field based on the value of another field

Post by Arvin Meye » Tue, 02 Oct 2007 12:05:19


Private Sub Driver_AfterUpdate()
Me.Loader = Me.Driver
End Sub

Where Loader is the name of the loader field textbox and Driver is the name
of the driver field textbox.

Change the names as necessary.
--
Arvin Meyer, MCP, MVP
http://www.yqcomputer.com/
http://www.yqcomputer.com/
http://www.yqcomputer.com/

 
 
 

Changing the value of one field based on the value of another field

Post by Marshall B » Tue, 02 Oct 2007 12:53:40


I think all you need in the Frover text box's AfterUpdate
event procedure is this kind of code:

If IsNull(Me.loader) Then
Me.loader = Me.driver
End If

If you don't want to keep an already filled in loader value,
then remove the If and End If lines.

If you only want to keep an already specified loader when it
was the same as the driver before the replacement driver was
entered, then change the If to:

If Me.driver.OldValue = Me.loader Or IsNull(Me.loader) Then

--
Marsh
MVP [MS Access]