Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Replicated Backend Doesn't Allow Update (2003)

    Why do you ALWAYS have an unnecessary reference to the OWC11 library, even in the padana_be.mdb backend databases that contains no code? <img src=/S/cranky.gif border=0 alt=cranky width=18 height=25>

    You are updating a record in a recordset that is based on the same table as the record source of the form. In a non-replicated database, Access often takes this in its stride, but sometimes you get an error message because it seen as an action by another process (user). In a replicated database, checking is more strict, so the error message appears more often. Try updating the record using Access code instead of ADODB code:

    Private Sub a_AfterUpdate()
    Dim strSQL As String
    strSQL = "UPDATE letture SET Lvds1 = " & Me.a & _
    " WHERE Giorno = " & (Me.Giorno + 1) & " AND ora = 0"
    DoCmd.SetWarnings False
    DoCmd.RunSQL strSQL, True
    DoCmd.SetWarnings True
    End Sub

  2. #2
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replicated Backend Doesn't Allow Update (2003)

    Sorry Hans, the OWC11 library was still there because I emptied Pad.mdb and used it to put the tables in. <img src=/S/blush.gif border=0 alt=blush width=15 height=15>
    I've substituted your code for the ADO one but when you edit the value for October 2, the value for the 0 hour of the next day doesn't get updated.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Replicated Backend Doesn't Allow Update (2003)

    Try

    strSQL = "UPDATE letture SET Lvds1 = " & Me.a & _
    " WHERE Giorno = #" & Format(Me.Giorno + 1, "mm/dd/yyyy") & "# AND ora = 0"

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Replicated Backend Doesn't Allow Update (2003)

    Sorry, no idea then. I don't work with replicated databases myself.

  5. #5
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Replicated Backend Doesn't Allow Update (2003)

    On the startup form of the attached Pad.mdb(whose replicated backend padana_b.mdb you can find here because it was too large to zip), please select, e.g., October 2, 2006 and click the "Production Readings" button. On the ensuing form, if you try and edit the value relevant to the 24th hour, answer yes to the message box asking if you want to edit the value and press ENTER, you get the message:
    <font color=red>run-time error '-2147217887 (80040e21)':
    Could not update; currently locked by another session on this machine.</font color=red>
    I don't get the message if I use an unreplicated back-end such as the one(padana_be.mdb) included in the attachment.
    How can I get rid of the error message?

  6. #6
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replicated Backend Doesn't Allow Update (2003)

    This time it works with the unreplicated back-end but with the replicated back-end I get the message:
    <font color=red>run-time error '3188':
    Could not update; currently locked by another session on this machine. </font color=red>
    which I suppose is the DAO equivalent of the previous ADO message.

  7. #7
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replicated Backend Doesn't Allow Update (2003)

    I've solved it by closing the [Copia di Scalve] form, updating the recordset and reopening the form.
    The problem now is that, because the form closes and reopens, if you input, e.g., 99735 for the record relevant to the 21,30 hour in the TERMICA text box and press ENTER, the focus goes to the same text box for the row corresponding to 0 hour instead of going to the next text box(BREMBANA) in the tab order.
    I've partially solved it by using the OpenArgs argument when opening the [Copia di Scalve] form but the focus invariably goes to the record for the 0 hour instead of remaining on the same row.
    How can I fix this?

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Replicated Backend Doesn't Allow Update (2003)

    The On Open event procedure of the Copia di Scalve form contains the line

    DoCmd.GoToRecord , , acLast

    and since the record source of this form is sorted descending on Ora, you'll always end up at Ora = 0. You'll have to

    - Remove the above line.
    - Pass the value of Ora to the form
    - In the On Load event, search for the record with the value of Ora.

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Replicated Backend Doesn't Allow Update (2003)

    You could use a global variable (declared in a standard module, not in the form module)

  10. #10
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replicated Backend Doesn't Allow Update (2003)

    Thank you Hans,
    Now when I input a value in the row for the 21,30 hour and press ENTER, the focus goes to the row for the 24 hour. It seems to me that the code line
    <font color=red>rst.FindFirst "[Giorno] >= #" & Format(Forms!Prev!CGior, "mm/dd/yyyy") & "# and [ora] = " & CDbl(OpenArgs)</font color=red>
    is working ok so what could be missing now?

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Replicated Backend Doesn't Allow Update (2003)

    By inserting

    On Error Resume Next

    you have made it impossible to troubleshoot. When you are developing, you shouldn't use that, unless it's unavoidable. Try this:

    rst.FindFirst "[Giorno] >= #" & Format(Forms!Prev!CGior, "mm/dd/yyyy") & "# and [ora] = " & Replace(Nz(OpenArgs, 0), ",", ".")
    If Not rst.NoMatch Then Me.Bookmark = rst.Bookmark

  12. #12
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replicated Backend Doesn't Allow Update (2003)

    Thank you Hans,
    By using OpenArgs to pass the value of Ora to the form, I cannot now use it to pass the UpdateOra0 sub the name of the text box(BREMBANA) to go to in the tab order so the focus remains on the text box(TERMICA) where the data has been entered.

  13. #13
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replicated Backend Doesn't Allow Update (2003)

    Thank you Hans,
    How do you pass the value of Ora to the form?
    When the form closes the OpenArgs value seems to lose its value so I get the message:
    <font color=red>Run-time Error '2498': An expression you entered is the wrong data type for one of the arguments.</font color=red>
    when I reopen it using the UpdateOra0 sub.

  14. #14
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Replicated Backend Doesn't Allow Update (2003)

    See <post:=607,371>post 607,371</post:>.

  15. #15
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replicated Backend Doesn't Allow Update (2003)

    <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>
    Thank you Hans

Page 1 of 2 12 LastLast

Posting Permissions

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