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 6890239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:15:25+00:00 2026-05-27T06:15:25+00:00

In my access database I have TABLE1 which is a linked table to a

  • 0

In my access database I have TABLE1 which is a linked table to a SQL 2005 server table. I have a query QUERY1 which selects a subset of TABLE1, manipulates / formats some of its data, and places that data into temporary table TMP_TABLE1 (ie. SELECT * INTO [TMPTABLE1] FROM [TABLE1]). I also have a form FORM1 that has TMP_TABLE1 as its recordsource where I can view and manipulate the data.

Here is my code that accomplishes these tasks:

On Error Resume Next
DoCmd.DeleteObject acTable, "TMPTABLE1"
On Error GoTo 0

DoCmd.SetWarnings False
CurrentDb.Execute "QUERY1", dbSeeChanges
DoEvents
DoCmd.SetWarnings True

DoCmd.OpenForm "FORM1", acNormal, , , , acDialog

The problem I am having is that my FORM1 tries to open before my QUERY1 finishes processing and I get an error stating my table does not exist. I have always experienced CurrentDb.Execute as a synchronous query and have only recently run into this behaviour. If I place a short pause or a loop waiting for the table to be created before opening the form, my procedure will work correctly.

Unfortunately, this is just one example of the underlying problem which I can’t remedy. For example, even if I keep the temporary table and simply delete all records and append all new records, the problem persists. This happens for any instances where I manipulate data in code before displaying it on screen such as INSERT statements, UPDATE statements, DAO.Recordset and ADODB.Recordset objects.

I have tested the compiled and uncompiled client on Windows 7 64-bit, Windows Vista 32-bit and Windows XP 32-bit and the all react the same way. The problem is intermittent and occasionally the query will finish quickly and my form will open correctly but 90% of the time it fails to open.

Does anyone have any ideas on what I can do? Maybe a setting got changed to run queries differently? Could it be a SQL Server 2005 option/setting I need to change?

EDIT:
Below is the most verbose code I could think of to try and wait for the table to be ready and it is still failing. Some times, my execute procedure throws an error saying that TMPTABLE1 already exists even though I delete it at the start of the function.:

On Error Resume Next
DoCmd.DeleteObject acTable, "TMPTABLE1"
On Error GoTo 0

Dim wrk As DAO.Workspace
Set wrk = DBEngine.Workspaces(0)
Dim dbs As DAO.Database
Set dbs = CurrentDb
wrk.BeginTrans
On Error GoTo TransErr
dbs.Execute "QUERY1", dbSeeChanges Or dbFailOnError
wrk.CommitTrans
TransResume:

Dim waitLoop As Long
Do While TableDefExists("_working_ReceivedMaterials") = False
    waitLoop = GetTickCount
    Do While GetTickCount < waitLoop + 100
        DoEvents
    Loop
Loop

DoCmd.OpenForm "ReceivedMaterials_Entry", acNormal, , , , acDialog

Exit Function
TransErr:
    wrk.Rollback
    GoTo TransResume
  • 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-27T06:15:25+00:00Added an answer on May 27, 2026 at 6:15 am

    Access can display strange behaviour sometimes when deleting tables and then re-creating them, therefore I dont’ think your code is tripping over itself, the best solution I think is to edit your form and change the recordset to nothing. Then on your forms “On_Load” event, set the recordset there e.g:

    Private Sub Form_Load()

    Me.Recordset = “SELECT * FROM TMPTABLE1”

    End Sub

    Alternatively, do not delete the table, just run “DELETE FROM TMPTABLE1” instead, and then instead of a make table query use “INSERT INTO TMPTABLE1 SELECT * FROM TABLE1”

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

Sidebar

Related Questions

I have multiple apps running which access a sql server database. I had initially
In an application we are developing, I have access to a database table which
I have an Access database in which I drop the table and then create
I have an Access 2003 database that connects to a SQL Server 2008 box
In a SQL database I have a table, Table1 . This table is related
In SQL Server 7.0, I need to find out which users have write access
I have a table in an Access 2007 database. All fields are of type
I have a ms access database that has one table for each photo album
I am building a form in access database. I have a combo box which
In a database I'm having to design for MS Access, I have a table

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.