Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2002
    Posts
    1

    Unhappy Unanswered: MS Error or Coding Error?

    Hello. I've got VBA code (Access 2k) in a form that moves field data to 4 strings which, after some character replacement, I try to post back with a DoCmd RunSQL UPDATE:

    DoCmd.RunSQL "UPDATE QARDOC_FIT_SCENARIO_TBL " & _
    "SET QARDOC_FIT_SCENARIO_TBL.TCT_SCENARIO_STATUS = '" & oStatus & "', QARDOC_FIT_SCENARIO_TBL.TCT_COMPLETION_DATE = '" & oCompletionDate & "', QARDOC_FIT_SCENARIO_TBL.TCT_COMMENT = '" & oTCTComment & "' " & _
    "WHERE QARDOC_FIT_SCENARIO_TBL.SCENARIO_ID = '" & oScenarioID & "';"

    It compiles and saves fine, but when the update Sub runs, I get
    "Run-time error '2486': You can't carry out this action at the present time"

    I've seen several folks on the forums with this error who think it's a MS bug, but I've also seen several who've had it go away after being instructed to clean up the code. Can you tell me who the culprit is? Thanks.

  2. #2
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    228
    The code itself looks ok, maybe you could insert spaces after the paramter values (don't think that matters though).
    One thing to try is to use the Execute method of the database object instead (with the currentdb object it would look like
    CurrentDb.Execute "UPDATE ...."). It is more flexible and likely to retrieve more accurate error information. Maybe it's just a locking issue.
    I personally try to avoid to use the methods of the DoCmd object whenever possible as they mostly seem to be just there for easy macro conversion.

Posting Permissions

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