I have a field called A, when somone update the B field, I would like the A
field get updated.
I wrote the below code but nothing is happening when i update the Submite
Date field. :(
Private Sub B_AfterUpdate()
Dim strSQL As String
Dim db As DAO.Database
Set db = CurrentDb()
strSQL = "UPDATE Requests" _
& " SET Requests.A=" & "Right([B],4) & '_' & [RequestID]" _
& " WHERE (((Requests.A) Is Null) AND ((Requests.[B]) Is Not Null))"
db.Execute strSQL
End Sub
Max - 04 May 2007 19:58 GMT
Note:
A is a text field
B is Date field
RequestID is Autonumber
> I have a field called A, when somone update the B field, I would like the A
> field get updated.
[quoted text clipped - 14 lines]
>
> End Sub
John W. Vinson - 04 May 2007 22:38 GMT
>I have a field called A, when somone update the B field, I would like the A
>field get updated.
Why?
It looks like you're storing information redundantly in the field A. It is NOT
necessary - nor is it a good idea! - to do so. What would happen if B were to
change, say by running an Update query or by someone opening another form?
Just calculate this concatenation in a Query or in the Control Source of a
textbox whenever you need it. Field A should *simply not exist* in your table.
Am I misunderstanding?
John W. Vinson [MVP]