Queries using access

Results 1 to 2 of 2

Thread: Queries using access

  1. #1
    Join Date
    Dec 1969

    Default Queries using access

    Im trying to simply display data from my query and it wont work. <BR>I know how to display data from a table. Is there anything different between the two other than changing this one line of code?<BR>objCommand.CommandText = "qryAllCompanies"<BR><BR><BR>Here is the error message im getting but that qry is in my database and i have uploaded it. <BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e37&#039 <BR><BR>[Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot find the input table or query &#039qryAllCompanies&#039. Make sure it exists and that its name is spelled correctly. <BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Understanding programming...

    The line you used:<BR><BR>objCommand.CommandText = "qryAllCompanies"<BR><BR>just asked Access to try to locate a *TABLE* with the *NAME* qryAllCompanies !!<BR><BR>More than likely, you don&#039t have such a table, right?<BR><BR>In VBScript, and indeed in virtually every programming language that exists, anything contained in quotes is a STRING. And a string is *not* to be touched, analyzed, extracted, or anything else by the language.<BR><BR>I would be willing to bet that you created a VBScript *variable* that happens to have the name qryAllCompanies. Am I right? That is, you did something like<BR><BR>qryAllCompanies = "SELECT ..."<BR><BR>Right?<BR><BR>So what you want to do, then, is simply:<BR><BR>objCommand.CommandText = qryAllCompanies<BR><BR>NO QUOTE MARKS! Because you want the CommandText to be the *CONTENTS* of the string that the variable qryAllCompanies represents.<BR><BR>This is really very, very fundamental computer language concepts. If you have trouble with this, it truly is time to go get a *GOOD* tutorial book and learn VBScript from the ground up.<BR><BR>(And apologies if this was a "slip of the fingers" and you are hitting your forehead and saying "DOH!" right now...in which case I will instead smile along with you.)<BR><BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts