• 3067: ‘Query must contain ..’ (Win2k, Access97)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » 3067: ‘Query must contain ..’ (Win2k, Access97)

    • This topic has 5 replies, 3 voices, and was last updated 23 years ago.
    Author
    Topic
    #370136

    I was fiddling w/ a database, and happened to not have a project hanging immediately over my head — so had the time to outline some anomalous behavior that occured. I have no questions, the problem is resolved — I merely post this for the curiosity:

    Synopsis:

    DoCmd.RunSQL “SELECT ReturnedAddresses.* INTO ZZ_Backup_” & Format(Date, “mm-dd-yyyy”) & ” FROM ReturnedAddresses;”

    Failed in Access 97 on Win2k machine w/ “3067: Query input must contain at least one table or query.”

    Initially, the “ReturnedAddresses” table was “[Returned Addresses List]”.

    A search on that error yielded that the VISDATA add-in that doesn’t like the brackets, which are required if the table name has spaces. I searched for any VISDATA components on _my_ machine, and did not find any. (Plus, removing the brackets to the table name would have avoided the bug.)

    I don’t like spaces anyway, so I took the liberty of renaming the table (it was not mine) and removed the brackets. Still, no go. It did not run.

    I changed date to now(), changed format$ vs format, removed the “Backup” from the “into” name.

    I closed, reopened Access, and rebooted, it did not run.

    I opened another ’97 database on the 2000 machine, which had a similar function, and it ran like a charm.

    I opened yet another ’97 database on the 2000 machine and built the code that was identical, and it did not run.

    I checked the lib references, and they were the same on all three databases.*

    I took a deep breath, and, while on the 2000 machine, recompiled and saved all in the database where the code was working, and it still worked after (I realize that this might not have been enough,from some vague memory of comments made here in the Lounge).

    I went over to my ’95 machine, and created a new form in the problem database, created the code, and everything worked!

    I moved to my 2000 machine, and ran the code in the new form w/out a hitch.

    Additionally on the 2000 machine, I then created a new button w/ a similar string in the new form, and everything worked.

    I discounted that the form was corrupted or that Access kept a reference to the earlier table name somehow, because of testing w/ the other database on the 2000 machine — but, I probably should have tried to run or edit the self-same form while on the ’95 machine to be a purist.

    Anyone have a clue? (Oops — I said that I had no questions — I really do not, but … I am still curious and wonder if there is any known thing that could explain this flukiness.

    *(The VBA332.dll on the 2000 machine showed as “3.0.0.7019”, while the vba332.dll on the ’95 machine showed as “3.0.7019”, fwiw — but the both had the same dates. The MSACC8.olb was the same. The DAO on all was 3.51 (dao350.dll of 4-1998). Additionally, a DAO360 was available on the 2000 machine.)

    Viewing 1 reply thread
    Author
    Replies
    • #584651

      Even though you don’t have a question, sort of, I’m not very surprised at your experience. We had numerous problems when we tried to run Access97 databases in Win2000 PCs. Some of them were resolved with Sr1 or SR2 for Win2000, but we found we got more reliable behavior with Win98 or WinNT4.

      On the other hand, we don’t recommend running Access2k on a Win95 PC. We’ve seen some strange things happen in that environment too. Just an FYI.

      • #584672

        I’m surprised at that, since I’ve never encountered problems with A97 on either NT or Win2k.

      • #585233

        Thank you, Wendell, for your words of wisdom. As it turns out, Charlotte was spot-on — the variance was in the dashes, and nothing else! the reason that the name-building code in the one database seemed to run fine, was that it had _underscores_. I had put one line directly below the other, and compared the docmd.sql call section by section, and _still missed that! It must be the eyes and the small font … although, I would have expected that dashes would be okay — see my response to Charlotte. The name-building-code in the successful attempt that I just happened to do on Windows95 is without either dashes _or_ underscores — my only excuse is that my mind must have been thoroughly boggled by that time .

        We have installed SR2. We have had some “inflexible” behavior w/ Access97 and Win2k, mostly excrutiatingly sloooooooow relinking of tables, and (for the couple of us that have the ability) excrutiatingly long times in popping up the properties of the database after the 1st or 2nd time (I wonder if there are other issues there other than Access97/Win2k, though). Also, Windows 2k refuses to load a database that exists on a Banyan network drive, but that’s probably not a “flukiness” issue, just one of moving away from backwards-compatibility. We only have a couple of databases still on our Banyan network. It’s a pain, none-the-less.

        > On the other hand, we don’t recommend running Access2k on
        > a Win95 PC. We’ve seen some strange things happen in that
        > environment too. Just an FYI.

        Thanks for the information. I’ll store this for future decision-making — I have discouraged us from upgrading to Access2k up ’til now for various reasons (mostly, “if it’s not ‘broke’ , don’t fix it,” and I guess I’m grateful that I did — except for the handful of us w/ Win2k machines where Access2k might have worked better, most are still on 95/98 machines.
        Thanks so much for your input, Wendell! I have archived off several of your messages on other issues (as well as several from others). Yours are among the messages that I look forward to reading,
        thx
        Pat

    • #584673

      I’m not surprised it failed, I’m surprised you ever got it to run. Once you actually generate the SQL, if you don’t but brackets around the destination table’s name, the query engine thinks those hyphens are minus signs and can’t figure out what you’re doing. The equivalent SQL using the Northwind Customers table fails on my Access 2000 unless I take the hyphens out or put brackets around the destination table name.

      • #585234

        Charlotte,

        > I’m not surprised it failed, I’m surprised you ever got it
        > to run. Once you actually generate the SQL, if you don’t
        > but brackets around the destination table’s name, the

        Thanks for looking at this for me — see my message to Wendell! I don’t know how I missed that the month-day-yr was separated by hyphens instead of underscores, which were present in the working copy (and which I had physically pasted one line below, to better compare if there was any difference in the strings … and the copy that I finally got working didn’t include either dashes _or_ underscores, and my brain was so blown as not to notice that glaring difference, by that time).
        I checked what you suggested, and sure enough, putting the brackets around the bld with dashes, handles the problem. _However_ :
        I would like to point out that Access help files only mention the need for brackets (that I can find) in the case of names w/ spaces. I see, though, that the query builder grid (if you look at the SQL generated) automatically puts brackets around names that include dashes — which of course, I bypassed when I created it myself.
        Thanks for your input! I appreciate this forum so much, and, as I’ve told Wendell, I’ve archived your messages, his, Marks, as well as other people’s. Thanks so much to all you who shape the Lounge!

        Pat

    Viewing 1 reply thread
    Reply To: 3067: ‘Query must contain ..’ (Win2k, Access97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: