Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Current record does not support updating...

Current record does not support updating...

Scheduled Pinned Locked Moved Database
databasebusinessregexhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    new_phoenix
    wrote on last edited by
    #1

    I have Error Message #3251 that occurs when I try to update one of the fields from one table based upon the value stored in another table. I am trying to compare the values of several fields in each of two tables, and when there is a match, I would like to assign the value of the second table to the value of the first table. When all records have had assignments, then I would perform a link between the first table and another table in the database, and then export the results with a portion of the data from each of the two tables in a query. Seems easier than trying to match a composite key from one table against a composite key from the other table. Besides, I don't think it is possible to compare composite keys. It seems better to merely compare indexes. Why doesn't it permit me to update the first table based upon results from the second table? I believe it has something to do with the Lock Type because the error message states: "Error and Error #3251: ADODB.Recordset: Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype." I need some assistance here. Here is the code so far:

    Private Sub ProcessHeadcountRecords()
    Dim dbsHeadcount As Database
    Dim Cnxn As ADODB.Connection
    Dim strConn As String
    Dim rstInputFile As ADODB.Recordset
    Dim cmdSQLInputFile As ADODB.Command
    Dim strSQLInputFile As String
    Dim rstHyperionMany As ADODB.Recordset
    Dim cmdSQLHyperionMany As ADODB.Command
    Dim strSQLHyperionMany As String
    Dim rstHyperionOne As ADODB.Recordset
    Dim cmdSQLHyperionOne As ADODB.Command
    Dim strSQLHyperionOne As String
    Dim strDBPath As String
    Dim strFileName As String
    Dim strMessage As String
    Set dbsHeadcount = CurrentDb

    Set cmdSQLInputFile = New ADODB.Command
    Set cmdSQLInputFile.ActiveConnection = Application.CurrentProject.Connection
    strSQLInputFile = "SELECT \[COUNTRY\], \[TYPE\], \[BUSINESS UNIT\], " & \_
        "\[L/R/G\], \[REGION\], \[JOB FUNCTION\], \[09/12/2007 Reported\], " & \_
        "\[NUMINDEX\] FROM \[TBLINPUTFILE\]"
    cmdSQLInputFile.CommandType = adCmdText
    cmdSQLInputFile.CommandText = strSQLInputFile
    Set rstInputFile = cmdSQLInputFile.Execute()
    rstInputFile.MoveFirst
    
    Set cmdSQLHyperionMany = New ADODB.Command
    Set cmdSQLHyperionMany.ActiveConnection = Application.CurrentProject.Connection
    strSQLHyperionMany = "SELECT \[COUNTRY\], \[TYPE\], \[BUSINESS UNIT\], " & \_
        "\[L/R/G\], \[REGION\], \[JOB FUNCTION\], \[NU
    
    P 1 Reply Last reply
    0
    • N new_phoenix

      I have Error Message #3251 that occurs when I try to update one of the fields from one table based upon the value stored in another table. I am trying to compare the values of several fields in each of two tables, and when there is a match, I would like to assign the value of the second table to the value of the first table. When all records have had assignments, then I would perform a link between the first table and another table in the database, and then export the results with a portion of the data from each of the two tables in a query. Seems easier than trying to match a composite key from one table against a composite key from the other table. Besides, I don't think it is possible to compare composite keys. It seems better to merely compare indexes. Why doesn't it permit me to update the first table based upon results from the second table? I believe it has something to do with the Lock Type because the error message states: "Error and Error #3251: ADODB.Recordset: Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype." I need some assistance here. Here is the code so far:

      Private Sub ProcessHeadcountRecords()
      Dim dbsHeadcount As Database
      Dim Cnxn As ADODB.Connection
      Dim strConn As String
      Dim rstInputFile As ADODB.Recordset
      Dim cmdSQLInputFile As ADODB.Command
      Dim strSQLInputFile As String
      Dim rstHyperionMany As ADODB.Recordset
      Dim cmdSQLHyperionMany As ADODB.Command
      Dim strSQLHyperionMany As String
      Dim rstHyperionOne As ADODB.Recordset
      Dim cmdSQLHyperionOne As ADODB.Command
      Dim strSQLHyperionOne As String
      Dim strDBPath As String
      Dim strFileName As String
      Dim strMessage As String
      Set dbsHeadcount = CurrentDb

      Set cmdSQLInputFile = New ADODB.Command
      Set cmdSQLInputFile.ActiveConnection = Application.CurrentProject.Connection
      strSQLInputFile = "SELECT \[COUNTRY\], \[TYPE\], \[BUSINESS UNIT\], " & \_
          "\[L/R/G\], \[REGION\], \[JOB FUNCTION\], \[09/12/2007 Reported\], " & \_
          "\[NUMINDEX\] FROM \[TBLINPUTFILE\]"
      cmdSQLInputFile.CommandType = adCmdText
      cmdSQLInputFile.CommandText = strSQLInputFile
      Set rstInputFile = cmdSQLInputFile.Execute()
      rstInputFile.MoveFirst
      
      Set cmdSQLHyperionMany = New ADODB.Command
      Set cmdSQLHyperionMany.ActiveConnection = Application.CurrentProject.Connection
      strSQLHyperionMany = "SELECT \[COUNTRY\], \[TYPE\], \[BUSINESS UNIT\], " & \_
          "\[L/R/G\], \[REGION\], \[JOB FUNCTION\], \[NU
      
      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      new_phoenix wrote:

      Set rstHyperionMany = cmdSQLHyperionMany.Execute()

      The Execute method returns a read-only recordset. You should use the Recordset.Open() method and specify an appropriate CursorType e.g. adOpenKeyset to make your recordset updateable.

      Paul Marfleet

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups