?
Solved

-2147352567  Exception occurred Error

Posted on 2010-01-12
4
Medium Priority
?
530 Views
Last Modified: 2013-11-27
I have the error :-2147352567  Exception occurred when I execute the code below.

The "tbl_MiseAJour" is a linked table
Private Sub UpdateTable_Click()
On Error GoTo Err_UpdateTable

    Dim dbs As DAO.Database
    Dim rsMAJ As DAO.Recordset
    Dim strTableMAJ As String
    Dim intCmpt As Integer
    Dim intNbrTable As Integer
    
    intCmpt = 0
    intNbrTable = 2

    DoCmd.Hourglass True
    DoCmd.SetWarnings False

    DoCmd.OpenQuery "qry_Uti_tbAVD_01_Delete"
    DoCmd.OpenQuery "qry_Uti_tbAVD_02_Add"
    intCmpt = intCmpt + 1

    DoCmd.OpenQuery "qry_Uti_tbASE_01_Delete"
    DoCmd.OpenQuery "qry_Uti_tbASE_02_Add"
    intCmpt = intCmpt + 1

    If intCmpt = intNbrTable Then
       MsgBox "Update completed, " & intCmpt & " / " & intNbrTable, vbInformation
       
        'Assign update date
        Set dbs = CurrentDb
        Set rsMAJ = dbs.OpenRecordset("tbl_MiseAJour", dbOpenDynaset)
        With rsMAJ
            .MoveFirst
            .Edit
            !dateMAJ = Now()
            .Update
        End With
       Me.txtDateMAJ = rsMAJ!dateMAJ
       rsMAJ.Close
    
    Else
        MsgBox "Update  UNCOMPLED, " & intCmpt & " sur " & intNbrTable, vbCritical
    End If
    DoCmd.Hourglass False
    DoCmd.SetWarnings True
    
Exit_UpdateTable:
    Exit Sub
Err_UpdateTable:
    DoCmd.Hourglass False
    DoCmd.SetWarnings True
    
    MsgBox "Error  Update tables " & Chr(13) & _
         Err.Number & "-" & Err.Description
    Resume Exit_UpdateTable
    
End Sub

Open in new window

0
Comment
Question by:Karl001
  • 2
4 Comments
 
LVL 46

Expert Comment

by:tbsgadi
ID: 26292152
Check that you have write permissions on tbl_MiseAJour

Gary
0
 

Author Comment

by:Karl001
ID: 26292188
I have the permissions to write on the tbl_MiseAJour.
Even I have the error message, the code  " !dateMAJ = Now() " is done.
I have the write date in tbl_MiseAJour

thanks
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 26292228
If Gary's suggestion doesn't solve this:

Can you determine where the error occurs? To do that, set a breakpoint on the "DoCmd.Hourglass True" line, then run the code. To set a BreakPoint, place your cursor in that line and press F9. This will highlight the line in Red. Now run the code (i.e. click the UpdateTable control), and you'll be taken to the VBA editor, and the line will now be highlighted in Yellow. Use the Debug menu to step through the code (note the keyboard shortcuts for items like Step Into), and let us know which line throws the error.

Is this an all-Access database? That is, your data is stored in Access and not something like SQL server or MySQL?
0
 

Author Closing Comment

by:Karl001
ID: 31676037
Thanks,
I solve my problem by setting a breakPoint.
It's was a wrong conception of coding
The table was not available to write in it.  At the same time, the table was used in a form.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question