A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

multiple statements updating a table with multiple values



 
 
Thread Tools Display Modes
  #1  
Old February 23rd, 2007, 01:15 PM posted to microsoft.public.access.queries
Millbrook School
external usenet poster
 
Posts: 1
Default multiple statements updating a table with multiple values

Im trying to do this

UPDATE [ICT & Electrical Audit Table] INNER JOIN Software ON [ICT &
Electrical Audit Table].[Internal Reference] = Software.[PC LICENCED FOR]
SET [ICT & Electrical Audit Table].Software = " "
UPDATE [ICT & Electrical Audit Table] INNER JOIN Software ON [ICT &
Electrical Audit Table].[Internal Reference] = Software.[PC LICENCED FOR]
SET [ICT & Electrical Audit Table].Software = [ICT & Electrical Audit
Table].Software & software.[internal reference] & " " & software.[software
title] & " format=" & software.[format] & " " & software.[serial number] &
chr$(13);

ie clear the content of [ICT & Electrical Audit Table].Software before
setting multiple query returns to it, but it dont like it..can anyone help?
  #2  
Old February 23rd, 2007, 01:47 PM posted to microsoft.public.access.queries
Michel Walsh
external usenet poster
 
Posts: 2,404
Default multiple statements updating a table with multiple values

Hi,


You issue it as two statements, do you? and have you tried to add
DISTINCTROW (after the keyword UPDATE) ? If you use MS SQL SERVER, instead
of Jet, try to use a WHERE clause, rather than the inner join (since
DISTINCTROW is Jet's proprietary syntax).


UPDATE table1 SET field1=something WHERE table1.OtherField IN (SELECT
table2.fieldName FROM table2)


Hoping it may help,
Vanderghast, Access MVP


"Millbrook School" wrote in
message ...
Im trying to do this

UPDATE [ICT & Electrical Audit Table] INNER JOIN Software ON [ICT &
Electrical Audit Table].[Internal Reference] = Software.[PC LICENCED FOR]
SET [ICT & Electrical Audit Table].Software = " "
UPDATE [ICT & Electrical Audit Table] INNER JOIN Software ON [ICT &
Electrical Audit Table].[Internal Reference] = Software.[PC LICENCED FOR]
SET [ICT & Electrical Audit Table].Software = [ICT & Electrical Audit
Table].Software & software.[internal reference] & " " &
software.[software
title] & " format=" & software.[format] & " " & software.[serial number] &
chr$(13);

ie clear the content of [ICT & Electrical Audit Table].Software before
setting multiple query returns to it, but it dont like it..can anyone
help?



  #3  
Old February 23rd, 2007, 01:53 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default multiple statements updating a table with multiple values

You would need to run TWO separate queries in Access.

In the first one, I would probably be setting the field to = Null instead
of to a single space. Actually, I would probably not even run the first
one, since the second query updates all the fields that you have just
blanked.

UPDATE [ICT & Electrical Audit Table] INNER JOIN Software
ON [ICT & Electrical Audit Table].[Internal Reference] = Software.[PC
LICENCED FOR]
SET [ICT & Electrical Audit Table].Software = " "

I would just use the following query to update the field
UPDATE [ICT & Electrical Audit Table] INNER JOIN Software
ON [ICT & Electrical Audit Table].[Internal Reference] = Software.[PC
LICENCED FOR]
SET [ICT & Electrical Audit Table].Software = software.[internal reference]
& " "
& software.[software title] & " format=" & software.[format] & " " &
software.[serial number] & chr$(13);

What I don't understand is why you are adding anything other than the
software internal reference field. All the other data seems to be in the
related table (Software) and would normally be accessed by linking to that
table.


By the way, adding just Chr(13) to an Access table field will simply display
a small square character in the field. If you are trying to add a line feed
at the end you need two characters a carriage return and a line feed (and in
that order).
& Chr(13) & Chr(10)
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Millbrook School" wrote in
message ...
Im trying to do this

UPDATE [ICT & Electrical Audit Table] INNER JOIN Software ON [ICT &
Electrical Audit Table].[Internal Reference] = Software.[PC LICENCED FOR]
SET [ICT & Electrical Audit Table].Software = " "
UPDATE [ICT & Electrical Audit Table] INNER JOIN Software ON [ICT &
Electrical Audit Table].[Internal Reference] = Software.[PC LICENCED FOR]
SET [ICT & Electrical Audit Table].Software = [ICT & Electrical Audit
Table].Software & software.[internal reference] & " " &
software.[software
title] & " format=" & software.[format] & " " & software.[serial number] &
chr$(13);

ie clear the content of [ICT & Electrical Audit Table].Software before
setting multiple query returns to it, but it dont like it..can anyone
help?



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:12 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.