Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2007

Tip: Looking for answers? Try searching our database.

Update

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Max - 04 May 2007 19:49 GMT
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]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.