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

  • Thread starter Thread starter barrycrone
  • Start date Start date
B

barrycrone

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.
 
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.

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.
 
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.

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
 
Back
Top