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  dBforums > PC based Database Applications > Microsoft Access > problem with update query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-26-09, 17:50
milenam milenam is offline
Registered User
 
Join Date: Jan 2009
Posts: 9
Red face problem with update query

Hi guys,

spent an afternoon doing this and thought I can get some help.
Ok I have a table HeaderTable where I have a field called HeaderInfo.
The HeaderInfo field is a string type and I use that field to trim a ReportingPeriod from it .Then for each row in that table with the result from the first query I would like to populate another field in the same table HeaderTable .
I use the following update with self join to do so:

UPDATE HeaderTable
INNER JOIN HeaderTable AS HeaderTable_1
ON HeaderTable.ID = HeaderTable_1.ID
SET HeaderTable.ReportingPeriod = (select mid(HeaderInfo,39,8) from HeaderTable);

It looks ok to me but whenever I click the update button it doesn`t seem to do anything it just displays the query`s design view.
The ID field in the table is a primary key.
Tried removing the Primary key and ran the query again, still no help.
I am sure something isn`t as it should be .


Will appreciate any help
Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 01-26-09, 20:06
StarTrekker StarTrekker is offline
L33t Helpa Munky
 
Join Date: Nov 2007
Location: Adelaide, South Australia
Posts: 4,049
What's the code you have behind the button?
__________________
Owner and Manager of
CypherBYTE, Microsoft Access Development Specialists.
Microsoft Access MCP.
And all around nice guy!


"Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
"...teach a man to code and he'll be frustrated for life! " -- georgev
Reply With Quote
  #3 (permalink)  
Old 01-27-09, 04:20
milenam milenam is offline
Registered User
 
Join Date: Jan 2009
Posts: 9
Hi ,
thanks for reply . I didn`t know I should have a code behind the button. Do you mean the update button. If so I will have alook and see what shall I have behind the button Does the query look ok ?

Thanks

Milena
Reply With Quote
  #4 (permalink)  
Old 01-27-09, 04:21
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,907
Code:
UPDATE HeaderTable
INNER JOIN HeaderTable AS HeaderTable_1 
ON HeaderTable.ID = HeaderTable_1.ID 
SET HeaderTable.ReportingPeriod = mid(HeaderInfo,39,8);
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On