Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2009
    Posts
    9

    Red face Unanswered: 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

  2. #2
    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

  3. #3
    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

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Code:
    UPDATE HeaderTable
    INNER JOIN HeaderTable AS HeaderTable_1 
    ON HeaderTable.ID = HeaderTable_1.ID 
    SET HeaderTable.ReportingPeriod = mid(HeaderInfo,39,8);
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •