Update

M

Max

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(,4) & '_' & [RequestID]" _
& " WHERE (((Requests.A) Is Null) AND ((Requests.) Is Not Null))"
db.Execute strSQL

End Sub
 
J

John W. Vinson

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top