Results 1 to 6 of 6
  1. #1
    mike_980 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    58

    Problem with runtime errors but only on one PC


    Hi everyone,
    I have a database which runs fine on newer computers which I have installed access runtime 2013 but we also have an older computer which needs to run the DB running on XP (probably a good 11 years old) that I have to install runtime 2010 as 2013 required a newer OS. When I try running my DB on this computer sometimes it works fine no issues at all whereas sometimes on button clicks "such as close form and save etc) I get a runtime error and it forces access to close down completely - this issue never happens on other computers which all run on windows 7 with runtime 2013 though. Does anybody know what might cause this?

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    I'm guessing the database itself was 2007+ as well. Have you attempted making a copy of your database (front end and back end if it's split) and converting it to 2003 format and seeing if this trouble user can use the database without generating errors? If you try it and it does work you may be able to keep your back end 2003 and have two different front ends, one built in access 2003, one in 2007+, but the back end would have to remain in the 'older' format for everyone to use it and the runtime components on the 'old' machine would have to be the 2003 components.

  3. #3
    mike_980 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    58
    Thanks for the reply - i've done a little digging and it turns out the runtime error occurs on all PCs, however when only access runtime is installed it comes up with the afore mentioned error and closes, whereas on my laptop with access 2013 I get the following:

    Click image for larger version. 

Name:	Untitled.png 
Views:	7 
Size:	136.1 KB 
ID:	14728

    The code itself isn't my own, it is an adapted version of some code I think "Its me" on here wrote me for closing my form containing a subform without saving any data. The code he wrote though after some more testing, allowed the data on the main form to be saved so I added in the docmd.runcommand acdeleterecord which seemed to work for a few weeks and now it is throwing this...

    Any ideas?

    I will attach the code for that button:

    Code:
    Private Sub Command40_Click()
    
    If MsgBox("Do you wish to cancel?", vbYesNo, "Delete Confirmation") = vbYes Then
    
    Dim db As DAO.Database
    Dim rsMain As DAO.Recordset
    Dim rsSub As DAO.Recordset
    
    Dim lngLagoonID As Long
    Dim lngSlurryID As Long
    
    Set db = CurrentDb
    Set rsMain = db.OpenRecordset("tbl_lagoon", dbOpenDynaset)
    Set rsSub = db.OpenRecordset("tbl_spreading", dbOpenDynaset)
    
    DoCmd.SetWarnings = False
    If Me.Dirty = True Then
    DoCmd.RunCommand acCmdDeleteRecord
    End If
    DoCmd.SetWarnings = True
    
    
    If Not IsNull(Me.ID.Value) Then 'Just to avoid Errors let's make sure we are working with something
    
        lngLagoonID = Me.ID.Value   'Get the PK for the record to be deleted
    
    
        
        If Not IsNull(Me.subfrm.Form.Slurry_spread_ID) Then 'Check to see if a record exists
    
        lngSlurryID = Me.subfrm.Form.Slurry_spread_ID   'Get the PK for the record to be deleted
    
    
        End If 'IsNull(Me.subfrm.Form.Slurry_spread_ID)
    
    
        rsMain.FindFirst "[ID] =" & lngLagoonID
        
            If rsMain.NoMatch = False Then
            
            rsMain.Delete
            
            End If
    
                rsSub.FindFirst "[Slurry_spread_ID] =" & lngSlurryID
            
                    If rsSub.NoMatch = False Then
            
                    rsSub.Delete
            
                    End If
    
    
    End If  'IsNull(Me.ID.Value)
    
    rsSub.Close
    Set rsSub = Nothing
    rsMain.Close
    Set rsMain = Nothing
    Set db = Nothing
    
    End If
    
    DoCmd.Close
    
    End Sub

  4. #4
    mike_980 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    58
    I may have solved it - I changed it from

    docmd.setwarnings = false

    to

    docmd.setwarnings false

    Seems to have sorted it out, but this form has alsways been abit of a problem child, can anyone see anything else that might give me any issues?

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    hah I was just about to post the = sign isn't supposed to be there.

    I don't use bound forms very often, partly for this very reason, it's much easier for me to control things like an 'undo' function so I probably wouldn't be much help on that.

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I found the other thread and I refreshed my memory a little. The way I remember it, the Docmd was causing issues because we had to shift focus from the main form to the subform and back, along with a one to many relationship or something.

    The solution I sugested was to eleminate the DoCmd entirely and rely on DAO to delete the records. So the code provided in the DB I uploaded does not use the Code block with the Docmd.

    Here is the procedure. I think it is as easy as commenting out your Docmd block of code. Let me know if this is not working. As I look at it, we may need to include a loop for the subform recordset and cascade delete relative rows.

    Code:
    Private Sub Command40_Click()
    
    Dim db As DAO.Database
    Dim rsMain As DAO.Recordset
    Dim rsSub As DAO.Recordset
    Dim lngLagoonID As Long
    Dim lngSlurryID As Long
    Set db = CurrentDb
    Set rsMain = db.OpenRecordset("tbl_lagoon", dbOpenDynaset)
    Set rsSub = db.OpenRecordset("tbl_spreading", dbOpenDynaset)
    
    If Not IsNull(Me.ID.Value) Then 'Just to avoid Errors let's make sure we are working with something
        lngLagoonID = Me.ID.Value   'Get the PK for the record to be deleted
    
        
        If Not IsNull(Me.subfrm.Form.Slurry_spread_ID) Then 'Check to see if a record exists
        lngSlurryID = Me.subfrm.Form.Slurry_spread_ID   'Get the PK for the record to be deleted
    
        End If 'IsNull(Me.subfrm.Form.Slurry_spread_ID)
    
        rsMain.FindFirst "[ID] =" & lngLagoonID
        
            If rsMain.NoMatch = False Then
            
            rsMain.Delete
            
            End If
                rsSub.FindFirst "[Slurry_spread_ID] =" & lngSlurryID
            
                    If rsSub.NoMatch = False Then
            
                    rsSub.Delete
            
                    End If
    
    End If  'IsNull(Me.ID.Value)
    rsSub.Close
    Set rsSub = Nothing
    rsMain.Close
    Set rsMain = Nothing
    Set db = Nothing
    DoCmd.Close
    End Sub

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

Similar Threads

  1. Replies: 10
    Last Post: 10-22-2013, 07:35 AM
  2. Please Help Runtime Errors :[
    By jamesgarf in forum Forms
    Replies: 3
    Last Post: 10-02-2012, 04:38 PM
  3. Replies: 6
    Last Post: 09-20-2012, 04:22 PM
  4. problem with access runtime
    By zol3x in forum Programming
    Replies: 7
    Last Post: 04-25-2012, 04:39 AM
  5. Problem with Access runtime
    By speckytwat in forum Access
    Replies: 4
    Last Post: 04-13-2011, 09:15 AM

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