dcsimg
Results 1 to 3 of 3

Thread: update query with 2 tables

  1. #1
    Join Date
    Nov 2002
    Posts
    13

    update query with 2 tables

    please can someone help

    i have two tables with info in
    is it possible to update a record in one table with a record from anoher table

    this is the code to do it in MS Access

    UPDATE tblPromo, tblCurrentUser
    SET tblPromo.PromoOperator = [UserName]
    WHERE (((tblPromo.PromoOperator) Is Null));

    i want to get the username from the tblcurrentuser and put it in Promooperator in tblPromo where PromoOperator is null

    hope someone can undesrtand me and help
    thanks

  2. #2
    Join Date
    Nov 2002
    Posts
    4
    I think the missing link here is join information between the two tables tblCurrentUser and tblPromo.

    perhaps this might work (if you file in the gaps):

    update tblPromo
    set tblPromo.PromoOperator = tblCurrentUser.UserName
    from tblPromo
    join tblCurrentUser
    on tblPromo.<pkid?> = tblCurrentUser.<fkid?>
    where tblPromoOperator is null

    I have assumed the tables are joined via pk and fk, but so long as a valid join and be made the join method should be valid.

    Cheers sduggan...

  3. #3
    Join Date
    Nov 2002
    Posts
    13
    thanx 4 ur help ill give it a try

Posting Permissions

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