ClearlyAnIdiot
Registered User.
- Local time
- Tomorrow, 03:26
- Joined
- Aug 22, 2013
- Messages
- 39
I'll first apologise for the ridiculous title.
Anyway, my goal is to use the SQL "Update" function to set the address of a company to the previous addresses when I update something. FOr example, the fields show as
Current=A
Previous=B
Previous 2=C
When I input something to "Current", I want it to end up like this
Current=New
Previous=A
Previous 2=B
The code I'm using right now is
Any tips?
Anyway, my goal is to use the SQL "Update" function to set the address of a company to the previous addresses when I update something. FOr example, the fields show as
Current=A
Previous=B
Previous 2=C
When I input something to "Current", I want it to end up like this
Current=New
Previous=A
Previous 2=B
The code I'm using right now is
Code:
Private Sub RegAddress_AfterUpdate()
Dim This As String
This = "UPDATE Companies SET PrevRegAddress1='" & Me.RegAddress & "' WHERE CompanyNumber='" & Me.CompanyNuber & "'"
DoCmd.RunSQL This
End Sub
Private Sub PrevRegAddress1_AfterUpdate()
Dim That As String
That = "UPDATE Companies SET PrevRegAddress2='" & Me.PrevRegAddress1 & "' WHERE CompanyNo='" & Me.CompanyNumber & "'"
DoCmd.RunSQL That
End Sub