Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7248519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:08:56+00:00 2026-05-28T22:08:56+00:00

EDIT: Changed as I have a different issue with the same code 2nd Edit:

  • 0

EDIT: Changed as I have a different issue with the same code

2nd Edit: Adding additional code that seems to be casuing the issue

I have created a vba program in access that aggregates data from a number of external sources and write the results into a new table. Ideally when I run the program I want to wipe out all of the data that is currently in the table and replace it with my new data. I am currently currently deleting all of the data in the table… then writing my new data

Here is the code for reference

Function getTestFixtures(FixtureName As String) As Recordset
Dim db As Database

Set db = OpenDatabase(GetDBPath & "TestFixtures.xlsx", False, False, "Excel 12.0;HDR=Yes;")

If db Is Nothing Then
     MsgBox "Can't find the file!", vbExclamation, ThisWorkbook.Name
     Exit Function
End If

Set getTestFixtures = db.OpenRecordset("Select * from [" & FixtureName & "$]")

End Function

The recordset created above is modified and the output data is placed in a dictionary and passed to this function.

Sub Write_OTDC_Data(POlist As Dictionary)
Dim Rst As Recordset


DoCmd.SetWarnings False
DoCmd.runsql "Delete * from [OTDC Results]"
DoCmd.SetWarnings True


Set Rst = CurrentDb.OpenRecordset("OTDC Results")

With Rst

  For Each key In POlist.Keys
    .AddNew
    For i = 0 To 9
        .Fields(i).value = POlist(key)(i)
    Next
    .Update
  Next
.Close
End With
End Sub

My Problem is that I get the following error if I try to change anything after running both of the above procuedures.

Error Message

Running either in isolation does not generate the error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T22:08:57+00:00Added an answer on May 28, 2026 at 10:08 pm

    I’m unsure whether this question is still unresolved. In case it’s not, I have some suggestions for you to try, but not a lot of confidence they will cure the problem.

    Try DoCmd.TransferSpreadsheet to import the sheet’s data into a scratch table instead of using OpenDatabase with the workbook.

    In your MsgBox, I wonder whether ThisWorkbook.Name means anything to an Access application. Aside from that, I would check whether the workbook exists, then open it (or import the sheet from it) only if the file is found.

    If Len(Dir(GetDBPath & "TestFixtures.xlsx")) = 0 Then
        'not found
    Else
        'use it
    End If
    

    Actually I’m unclear why you don’t get an error from OpenDatabase if the workbook file doesn’t exist. And that makes me suspicious of DoCmd.SetWarnings False Never, ever turn SetWarnings off. Doing so suppresses important information. And it is completely unnecessary. Set a DAO.Database object variable to CurrentDB(), then use this instead:

    dbObjectVariable.Execute "Delete from [OTDC Results]", dbFailOnError 
    

    Add an error handler to deal with any problems dbFailOnError exposes.

    Finally, this bears repeating because it’s so important. NEVER turn SetWarnings off.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have developed a system that uses a single code base, consisting of four
I have multiple webpages that work together. Most of them have the same css
Edit: From another question I provided an answer that has links to a lot
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
I have an issue with the following text display: <asp:RegularExpressionValidator ID=Password_RegularExpValidate runat=server Text=TEST! Display=Dynamic
We have an application running where IIS and SQL are on the same machine.
I have 2 different web servers on a Debian Lenny machine. One is running
I have a very peculiar issue with Python library. I downloaded the a python
EDIT: changed the title. I didn't know it at the time but this is
I have a bit of code like this in my template: #{list people, as:'person'}

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.