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 / Queries / February 2008

Tip: Looking for answers? Try searching our database.

Update query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
scottyfitz@gmail.com - 14 Feb 2008 20:26 GMT
Hello. I have been trying to update a field using the value of the
same field in a different row. I have an policy table that has a
postal code field. There are several records per policy but not all
have the postal code filled in (the field was just recently added to
the table). I need all the records for each policy to have a postal
code filled in. I have been trying this

UPDATE [Policy-Auto] SET [Policy-Auto].[AGA-CLIENT-POSTAL] = [AGA-
CLIENT-POSTAL]
WHERE (((Exists (SELECT [AGA-CLIENT-POSTAL] from [Policy-Auto] C
WHERE C.[AGA-CLIENT-POSTAL] <> ""))<>False) AND (([Policy-
Auto].PregId)=214310));

but it isn't working. In the above I'm trying to set just one policy.
There are 11 rows for the particular policy I'm testing above (one
with a value and 10 without) but it tells me there are 11 rows going
to be updated (but they are actually just left as they were). I feel
like I'm close but clearly missing something. Any help is much
appreciated.

Scott
KARL DEWEY - 14 Feb 2008 20:51 GMT
Backup the database and try this --
UPDATE [Policy-Auto] INNER JOIN [Policy-Auto] AS [Policy-Auto_1] ON
[Policy-Auto].regId = [Policy-Auto_1].regId SET
[Policy-Auto].[AGA-CLIENT-POSTAL] = [Policy-Auto_1].[AGA-CLIENT-POSTAL]
WHERE ((([Policy-Auto].[AGA-CLIENT-POSTAL]) Is Null) AND
(([Policy-Auto_1].[AGA-CLIENT-POSTAL]) Is Not Null));

Signature

KARL DEWEY
Build a little - Test a little

> Hello. I have been trying to update a field using the value of the
> same field in a different row. I have an policy table that has a
[quoted text clipped - 17 lines]
>
> Scott
scottyfitz@gmail.com - 15 Feb 2008 13:04 GMT
On Feb 14, 5:51 pm, KARL DEWEY <KARLDE...@discussions.microsoft.com>
wrote:
> Backup the database and try this --
> UPDATE [Policy-Auto] INNER JOIN [Policy-Auto] AS [Policy-Auto_1] ON
[quoted text clipped - 31 lines]
>
> - Show quoted text -

Hi Karl. This works perfectly. Thank you very much for your help. I
really appreciate it.

Scott
 
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



©2008 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.