Results 1 to 3 of 3

Thread: Cannot Update A Record

  1. #1

    Thread Starter
    Lively Member VB_client's Avatar
    Join Date
    Feb 2004
    Location
    India
    Posts
    87

    Cannot Update A Record

    What's the problem in the following code ?
    How can I write an alternate?

    VB Code:
    1. sql = "SELECT A.EMP_DEPT_CODE FROM EMP_MASTER A, EMP_DEPT B WHERE A.EMP_ID = B.EMP_ID AND B.EMP_DEPT_ID = 3"
    2. rst.open sql, DB_CONN, adOpenDynamic, adLockOptimistic
    3. Do Until rst.EOF
    4.   rst("EMP_DEPT_CODE") = "NEW_CODE"
    5.   rst.Update
    6.   rst.MoveNext
    7. Loop
    8. rst.Close

    It's giving error

    Run-time error '3251':
    Current Recordset does not support updating. This may be a limitation of the Provider, or of the Selected locktype.
    In order to be successful all you need is a little faith within yourself

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Cannot Update A Record

    What is "NEW_CODE"?

  3. #3
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Cannot Update A Record

    I never use the .Upate Subroutine. I just use UPDATE SQL statements. Try that instead.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

Posting Permissions

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



Click Here to Expand Forum to Full Width