-2147352567  Exception occurred Error

Posted on 2010-01-12
Medium Priority
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
            !dateMAJ = Now()
        End With
       Me.txtDateMAJ = rsMAJ!dateMAJ
        MsgBox "Update  UNCOMPLED, " & intCmpt & " sur " & intNbrTable, vbCritical
    End If
    DoCmd.Hourglass False
    DoCmd.SetWarnings True
    Exit Sub
    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

Question by:Karl001
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 46

Expert Comment

ID: 26292152
Check that you have write permissions on tbl_MiseAJour


Author Comment

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

LVL 85

Accepted Solution

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?

Author Closing Comment

ID: 31676037
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.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

765 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