Results 1 to 8 of 8
  1. #1
    Jingru is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Mar 2022
    Posts
    7

    strange issue with Run-time error "3188"

    Dear all,



    I am using access 2013 and windows 10. I have a strange issue with Run-time error "3188". I have check me.dirty=false.
    you can find the code follwoing(bug part is marked with amber):


    Private Sub bSave_Click()
    Dim dbsCurrent As DAO.Database
    Dim rstATS As DAO.recordset
    Dim strQuery As String
    Dim CurrentID As Integer
    Dim CAcurrent As String

    CurrentID = Me.OpenArgs
    Set dbsCurrent = CurrentDb
    strQuery = "SELECT * " & _
    "FROM [Technical Logbook] " & _
    "WHERE ID = " & CurrentID
    Set rstATS = dbsCurrent.OpenRecordset(strQuery)


    If Not IsNull(rstATS![Corrective Action]) Then
    CAcurrent = rstATS![Corrective Action]
    If Me.CANew <> "" Then
    rstATS.Edit
    rstATS![Corrective Action] = CAcurrent & _
    "<div> </div>" & _
    "<div>" & Me.CANew.Value & "</div>" & _
    "<div>" & "/*" & UserNameWindows() & " - " & Now() & "*/" & "</div>"

    rstATS.Update

    DoCmd.Close
    Else
    MsgBox "Please enter a new corrective action"
    End If
    Else
    If Me.CANew <> "" Then
    rstATS.Edit
    rstATS![Corrective Action] = "<div>" & Me.CANew.Value & "</div>" & _
    "<div>" & "/*" & UserNameWindows() & " - " & Now() & "*/" & "</div>"
    rstATS.Update
    DoCmd.Close
    Else
    MsgBox "Please enter a new corrective action"
    End If
    End If
    End Sub

    it's really strange that clleagues using window 8 have not this issue. could any one please help me?
    Thanks a lot in advance!

    Best,
    Jingru

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,526
    Instead of code,can’t you just run an update query?

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    5,008
    And 3188 is?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,122
    Is the form unbound? You use OpenArgs so it looks like it is some sort of popup edit form that you open from another, is the first form bound to [Technical Logbook] and dirty?
    I revised your code a bit:
    Code:
    Private Sub bSave_Click()
    Dim dbsCurrent As DAO.Database
    Dim rstATS As DAO.recordset
    Dim strQuery As String
    Dim CurrentID As Integer
    Dim CAcurrent As String
    
    
    CurrentID = Me.OpenArgs
    Set dbsCurrent = CurrentDb
    strQuery = "SELECT * " & _
    			"FROM [Technical Logbook] " & _
    			"WHERE ID = " & CurrentID
    			
    Set rstATS = dbsCurrent.OpenRecordset(strQuery)
    
    
    
    
    If Not IsNull(rstATS![Corrective Action]) Then
    	CAcurrent = Nz(rstATS![Corrective Action])
    		If Me.CANew <> "" Then
    			rstATS.Edit
    			rstATS![Corrective Action] = CAcurrent & _
    										"<div> </div>" & _
    										"<div>" & Me.CANew & "</div>" & _
    										"<div>" & "/*" & UserNameWindows() & " - " & Now() & "*/" & "</div>"
    			rstATS.Update
    			DoCmd.Close
    		Else
    			MsgBox "Please enter a new corrective action"
    		End If
    'Else
    		'If Me.CANew <> "" Then
    			'rstATS.Edit
    			'rstATS![Corrective Action] = "<div>" & Me.CANew & "</div>" & _
    											"<div>" & "/*" & UserNameWindows() & " - " & Now() & "*/" & "</div>"
    			'rstATS.Update
    			'DoCmd.Close
    		'Else
    			'MsgBox "Please enter a new corrective action"
    		'End If
    End If
    End Sub
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    Jingru is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Mar 2022
    Posts
    7
    Quote Originally Posted by ranman256 View Post
    Instead of code,can’t you just run an update query?
    thanks a lot for the reply. I will try this

  6. #6
    Jingru is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Mar 2022
    Posts
    7
    Runtime error 3188. Could not update; currently locked by another session on this machine. I think there is something to do with the lenth of string. I will open a new post to disscuss it. thanks a lot.

  7. #7
    Jingru is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Mar 2022
    Posts
    7
    Quote Originally Posted by Gicu View Post
    Is the form unbound? You use OpenArgs so it looks like it is some sort of popup edit form that you open from another, is the first form bound to [Technical Logbook] and dirty?
    I revised your code a bit:
    Code:
    Private Sub bSave_Click()
    Dim dbsCurrent As DAO.Database
    Dim rstATS As DAO.recordset
    Dim strQuery As String
    Dim CurrentID As Integer
    Dim CAcurrent As String
    
    
    CurrentID = Me.OpenArgs
    Set dbsCurrent = CurrentDb
    strQuery = "SELECT * " & _
                "FROM [Technical Logbook] " & _
                "WHERE ID = " & CurrentID
                
    Set rstATS = dbsCurrent.OpenRecordset(strQuery)
    
    
    
    
    If Not IsNull(rstATS![Corrective Action]) Then
        CAcurrent = Nz(rstATS![Corrective Action])
            If Me.CANew <> "" Then
                rstATS.Edit
                rstATS![Corrective Action] = CAcurrent & _
                                            "<div> </div>" & _
                                            "<div>" & Me.CANew & "</div>" & _
                                            "<div>" & "/*" & UserNameWindows() & " - " & Now() & "*/" & "</div>"
                rstATS.Update
                DoCmd.Close
            Else
                MsgBox "Please enter a new corrective action"
            End If
    'Else
            'If Me.CANew <> "" Then
                'rstATS.Edit
                'rstATS![Corrective Action] = "<div>" & Me.CANew & "</div>" & _
                                                "<div>" & "/*" & UserNameWindows() & " - " & Now() & "*/" & "</div>"
                'rstATS.Update
                'DoCmd.Close
            'Else
                'MsgBox "Please enter a new corrective action"
            'End If
    End If
    End Sub
    Thanks a lot. I tired it but doenot work. I think there is something to do with the lenth of string.

  8. #8
    Jingru is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Mar 2022
    Posts
    7
    The strange thing is 1.my colleages using window 8 don't have this issue; 2.this issue comes up when the length of string is more than 2200. So I am thinking there is something to do with the buffer size of different windows version.
    And you can find what happend in the following picture:
    Click image for larger version. 

Name:	Unbenannt.PNG 
Views:	9 
Size:	233.4 KB 
ID:	47536

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Error: "Cannot update. Databse or Object is read-only" Issue
    By excellenthelp in forum Programming
    Replies: 6
    Last Post: 05-10-2022, 04:20 AM
  2. Replies: 8
    Last Post: 04-21-2021, 09:44 AM
  3. Replies: 2
    Last Post: 08-28-2015, 01:45 AM
  4. Replies: 1
    Last Post: 03-14-2013, 12:39 PM
  5. Replies: 4
    Last Post: 07-25-2012, 04:01 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums