Copy record from previous field if specific combobox value

terrysaunders

New member
Local time
Today, 12:05
Joined
Sep 17, 2013
Messages
3
Hi all

I have an access form that needs filling in daily by various people.

It's to document changes to a website and I currently have a combobox box set up for the various sections to state whether they are AMENDS, REVERTS or NO CHANGE.

I have set conditional formatting to then highlight these sections but am also trying to get it to work so that if the user chooses "NO CHANGE" then the data for that field copies over from the previous record.

I have set this up in the AfterUpdate code for the combobox, but nothing is happening, not even an error... can anyone help?

Code:
Private Sub COMBOBOX1_AfterUpdate()
If Me.COMBOBOX1 = 3 Then
Me.[FIELD_TO_CHANGE] = DLookup("[FIELD_TO_CHANGE]", "tb_TABLE", "[ID]=Forms![form_FORM]![ID]-1")
End If
End Sub

(Where 3 is the value of NO CHANGE in the combobox, and FIELD_TO_CHANGE, tb_TABLE and form_FORM being the names of the various elements)

Thanks!
 
Try this:
Me.[FIELD_TO_CHANGE] = DLookup("[FIELD_TO_CHANGE]", "tb_TABLE", "[ID]=" & Forms![form_FORM]![ID] -1)
 

Users who are viewing this thread

Back
Top Bottom