Results 1 to 3 of 3
  1. #1
    Martao is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    3

    Unclear VBA/Access error message I dont understand

    Hello,

    I am coding on a vba program to load an XML file into an(other) access 2003 database.
    I'm putting the data in 4 tables now, which worked fine until the 3rd table / AdoDB.Recordset.
    On updating the 4th Recordset Im getting a very vague error. I already toggled all code that manipulated the table to comments, except filling in the primary key. So, basically nothing happens except .Open, .AddNew and . Update

    On recordset.Update I'm getting the following error (1st line translated from Dutch):



    "Error -2147217887 (80040e21) during execution:

    Invalid Reference test code"

    I can't see anything wrong with the code; it's similar to the other tables that worked fine. Unfortunately, Google didnt help me find any lead on the problem. Can anyone help/explain me what the error message should mean?

    Here's a small code snippet:

    Code:
     
    Dim VisitID As Integer
    VisitID = 21 
    'this is a simplified version for debugging; normally the ID comes from another table
     
    Dim dbHFA As New ADODB.Connection
    dbHFA.Provider = "Microsoft.Jet.OLEDB.4.0"
    dbHFA.Open "hfa.mdb"
     
    Dim tableThreshold As New ADODB.Recordset
    tableThreshold.Open "Threshold_Test", dbHFA, adOpenDynamic, adLockPessimistic
    tableThreshold.AddNew
    tableThreshold("VISIT_ID").Value = VisitID
    tableThreshold.Update
    Thanks in advance!

  2. #2
    Martao is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    3
    Ok, sorry, I forgot to mention that the same error also appears when I comment the VisitID part out - even though that this is the primary key.

    For the sake of completeness I edited the code snippet.
    VISIT_ID is a long integer in the Access DB.

  3. #3
    Martao is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    3
    OK, never mind, I'm an idiot.
    I had a custom validation on one of the fields and the default value wasnt valid.

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

Similar Threads

  1. Error Message
    By Juan4412 in forum Forms
    Replies: 5
    Last Post: 03-06-2011, 04:22 PM
  2. SQL - How to make Access understand time-span?
    By Jimmy_XistenZ in forum Queries
    Replies: 4
    Last Post: 10-12-2010, 12:21 PM
  3. Need To Understand MS Access Across A Network
    By johnmagu in forum Access
    Replies: 8
    Last Post: 05-25-2010, 03:14 PM
  4. error message
    By ngeng4 in forum Forms
    Replies: 85
    Last Post: 03-25-2010, 06:47 AM
  5. Error Message after exporting MS Access Table
    By samjoseph in forum Access
    Replies: 1
    Last Post: 02-22-2010, 04:08 PM

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