Results 1 to 4 of 4
  1. #1
    jcgragav is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    2

    Error when executing access quries from vba project.

    Hi,

    I am facing an error and my query is not completed when executing from excel vba project.

    I have written a vba pgm to create around 6 tables and access the table to create a dashboard kind of report.


    in my script i am deleting all the tables which is already available in the db and i am creating the same tables.
    in that my first table is creating around 20k records but it ends with an abort. so my vba script is not executing the other queries and all the script lines reading the tables got error due to the tables got deleted.

    i think this is like a timwout issue while creating a 20k records in my first table. so all other tables are not created..

    please help me. I will provide furthere information.

    Thanks
    Ragav

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Why are you deleting the tables each time? Does the structure of the tables change between runs?
    If not, instead of deleting the tables and re-creating them (which causes bloat), execute delete queries to clear the tables. (Still has bloat, but not as bad as deleting/re-creating tables).

    Then all you have to do is run the append queries.

    You should single step through the code to find out why it is aborting.....

  3. #3
    jcgragav is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    2
    Hi Steve,

    I am getting an error: Run-time error 1004: Application-defined or "object-defined" error.

    I tried deleting the records instead of table..

    Here is what i am trying to do...
    cnt.Execute ("DROP TABLE TBL_ABC")
    cnt.Execute ("DROP TABLE TBL_ABCD")
    cnt.Execute ("DROP TABLE TBL_ABCDEF")
    cnt.Execute ("DROP TABLE TBL_ABCDEFGH")

    but the TBL_ABC itslef not deleted and i am facing the 1004 run-time error.

    Please advice.

    thanks
    ragav

  4. #4
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    To delete all records from a table:

    Code:
    cnt.Execute ("DELETE * FROM TBL_ABC"), dbfailonerror
    Replace TBL_ABC with your table name.

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

Similar Threads

  1. Replies: 1
    Last Post: 04-19-2012, 05:05 PM
  2. Exception When Executing In Java But Runs In MS Access DB Manually
    By vasuresh.kishor@gmail.com in forum Access
    Replies: 0
    Last Post: 03-11-2010, 12:22 AM
  3. Executing .BAT file from Access
    By NoiCe in forum Programming
    Replies: 23
    Last Post: 03-02-2010, 09:36 PM
  4. Executing Access macro
    By Gnorro in forum Access
    Replies: 2
    Last Post: 09-21-2009, 08:32 AM
  5. Replies: 0
    Last Post: 09-11-2006, 07:11 AM

Tags for this Thread

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