Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    DAY4 is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2021
    Posts
    10

    Copy data from one db to another using 'Select * Into... From... IN...' suddenly giving RT err 3251

    I wrote a sub last year to copy tables from an archived backend into the live database.
    It has been working fine for the past 10 months but now all of a sudden is giving me a Run-Time error '3251': Operation is not supported for this type of object.



    Here is a bit of test code that I set up in a new database and I get the same error.

    Code:
    Sub test()
    
    
        Dim dbPath As String
        Dim tblName As String
        
        dbPath = "S:\DataHome\BidBunker_DATA.accdb"
        tblName = "tblBookmarks"
        
        DoCmd.RunSQL "SELECT * INTO newTable FROM " & tblName & " IN '" & dbPath & "'"
    
    
    End Sub
    The fact that I am getting the error in a brand new database seems to indicate that some sort of office update is to blame but I am not sure how to verify that. I am using office 365.
    any ideas? thanks in advance

  2. #2
    DAY4 is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2021
    Posts
    10
    I just copied the sql text directly into a new query design SQL mode and it also gives the same result. So it's got to be an office update. right?

  3. #3
    orange's Avatar
    orange is online now Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    You could try adjusting the SQL. Seems tblName would be a string, so you may need single quotes
    DoCmd.RunSQL "SELECT * INTO newTable FROM '" & tblName & "' IN '" & dbPath & "'"

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    I use similar code regularly without issues and I have the current version 2102 of Access 365 .... so I think you can probably discount that as an issue

    Anyway, as a test, I used your exact code & it worked fine ... even when I had the the source table open in the source db

    You could try changing the last line to the more efficient version
    Code:
    CurrentDb.Execute "SELECT * INTO newTable FROM " & tblName & " IN '" & dbPath & "'", dbFailOnError
    However, if newTable already exists, you will get error 3010

    Check what happens if you import the table using the External Data ribbon item
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    DAY4 is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2021
    Posts
    10
    Thanks Orange, I did try that and I get a syntax error. Plus I know that it was working before with no changes for several months.

  6. #6
    DAY4 is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2021
    Posts
    10
    Thanks isladogs, I appreciate the fast and thorough answer. however with your suggested code I am getting the exact same error. I called my brother and and had him test my code as well and it worked for him. (he's not a developer but he has the full office suite on his machine)

    So it has to be something wrong on my computer but I am not sure where to look. Supposing it was an office update that I got how would I go about reverting back?
    Last edited by DAY4; 04-02-2021 at 07:47 AM. Reason: removing broken attachment link

  7. #7
    DAY4 is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2021
    Posts
    10
    I also forgot to mention in the original post that using the External Data Ribbon works fine as you might expect, so, I'm not sure what that means.

  8. #8
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    something wrong with your attachment link ("invalid")
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #9
    DAY4 is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2021
    Posts
    10
    Sorry, It didn't have any real new information. It was just a screen shot of the error pop up with the suggested changes from isladogs

  10. #10
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    I also got an error with your attachment. If you can try and upload the file, I'll be happy to test it on my workstation.

    You haven't said which version of A365 you have though I still doubt that is the issue.
    There is info online about how to revert to an earlier version. I've done it myself but don't have the details to hand

    The single quotes are definitely not correct in this type of code. It sometimes helps to use this syntax
    ... FROM [" & tblName & "] ...
    The [] brackets are essential if the table name contains a space or special character...but that isn't the case here

    Personally, I'd recommend that you don't create a new table each time.
    Instead use an INSERT (append) query to add new records. If necessary, use a DELETE query to empty the table beforehand.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  11. #11
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    It was just a screen shot of the error pop up
    Really no need to zip pics and frankly, it's an unnecessary pain in the butt. There is an "insert image" button on the toolbar.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  12. #12
    DAY4 is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2021
    Posts
    10
    So... researching my Office version I found out that I am an Office Insider (That's probably a mistake) meaning I get new builds of Office weekly on their Beta Channel. I messaged them to get some support but I have not gotten a response back yet. Just letting everyone here know that I am suspecting some sort of beta version bug. Is there anyone else here that gets regular insider updates that can confirm they have the same issue, or that they are not having the issue?

  13. #13
    DAY4 is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2021
    Posts
    10
    Quote Originally Posted by Micron View Post
    There is an "insert image" button on the toolbar.
    right, I used the insert image button and I could see it just fine. but after you mentioned the error, I just removed it so that no one would be confused. because like I said there wasn't any real new information in the image.

  14. #14
    DAY4 is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2021
    Posts
    10
    Quote Originally Posted by isladogs View Post
    Personally, I'd recommend that you don't create a new table each time.
    Instead use an INSERT (append) query to add new records. If necessary, use a DELETE query to empty the table beforehand.
    So a little more background info. This is a large database. the other db file that I am copying from contains archived data that I don't need very often, only in certain cases. there are already 50+ tables in the live DB so I use VBA-SQL to copy the data in run the query then delete the table when we are done.

    I agree that appending is preferable most of the time. (and maybe that is the solution) I was trying to avoid having 20 empty tables just sitting there in the file. I haven't even tried that yet so I'll let you know if it even works.

    Thanks again for all the suggestions.

  15. #15
    DAY4 is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2021
    Posts
    10
    Quote Originally Posted by isladogs View Post
    Personally, I'd recommend that you don't create a new table each time.
    Instead use an INSERT (append) query to add new records. If necessary, use a DELETE query to empty the table beforehand.
    So I tried it and I get the same error:

    Code:
    INSERT INTO newTable SELECT * FROM tblBookmarks IN 'S:\DataHome\BidBunker_DATA.accdb';
    so it's not the creating of a new table that is the issue, it somehow has to do with referencing the other database...
    Last edited by DAY4; 04-02-2021 at 08:38 AM. Reason: re pasting code with better format

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 05-07-2020, 06:58 AM
  2. Runtime Error 3251 object not supported
    By avanduyvenbode in forum Programming
    Replies: 2
    Last Post: 10-18-2016, 09:54 AM
  3. Audit Trail Code - Error 3251
    By Juans in forum Access
    Replies: 3
    Last Post: 01-04-2015, 02:21 PM
  4. Checkbox OldValue property gives Error 3251
    By Monterey_Manzer in forum Programming
    Replies: 11
    Last Post: 05-06-2014, 03:10 PM
  5. Giving a specific number to some data
    By Knelou in forum Forms
    Replies: 1
    Last Post: 09-12-2013, 08:45 PM

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