Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2004
    Location
    Dallas, TX
    Posts
    77

    Unanswered: how to write this update sql statement?

    I have one table with number identity, I want to set its one column value for the last row

    i know i can write it with 2 seperate sql statement like this:
    strSql = "select max(dealNum) from tblm_deal"
    Set rscp = con.Execute(strSql)
    con.Execute strSql
    strSql = "update tblm_deal set modelNum = 3 where dealNum = " & rscp.Fields(0)

    Does anybody know how to write the sql statement in one sentence? such as
    update tblm_deal set modelNum = 3 where dealNum = select max(dealNum) from tblm_deal

    thanks a lot. appreciate for any help

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    try:
    UPDATE tblm_deal set modelNum = 3 WHERE dealNum = DMax("dealNum", "tblm_deal)
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Sep 2004
    Location
    Dallas, TX
    Posts
    77
    thanks a lot. it helps a lot
    and sorry, i don't know why i made the multi post for same post. sorry.

Posting Permissions

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