HOWTO: Use ADO To Query An Access Table With A Space In Its

ID: Q189683


The information in this article applies to:


SUMMARY

ADO allows you to query a table based solely on its name. If just a table name is specified, ADO prepends select * from and executes that query. If the table you want to query is an Access table with a space in its name, you need to place square brackets around the table's name.


MORE INFORMATION

If you want to query the Order Details table in the Access Northwind (NWind.MDB) database that ships with many products using ADO, you need to use code like the following:


   rsOrderDetails.Open "[Order Details]", cnNWind, adOpenStatic, _
                   adLockReadOnly, adCmdTable 
You can also use the back quote if you need to use the table name with spaces. For example:

   select * from `Order Details`. 
NOTE: You can only use the back quote in Access.

This information also applies when using the ADO Data Control that ships with Visual Basic 6.0.


REFERENCES

  1. Connect to Support Online at the following Internet address:


  2. http://support.microsoft.com/support/default.asp
  3. In the My Question Is About box, select All Products.


  4. In the My Question Is box, type the Article ID (qnumber) of the article that you want to see. For example, type "Q162192" (without the quotation marks).


  5. Click Find (next to the My Question Is box). This search will return from one to several article titles. The Article ID appears in the upper-left corner of the article. You can see the Article ID only after you click to view the article.


  6. Click the title of the article to view it.


Additional query words: kbADO150 kbADO200 kbVBp500 kbVBp600 kbMDAC200


Keywords          : kbADO150 kbADO200 kbVBp500 kbVBp600 kbMDAC200 
Version           : WINDOWS:1.5,2.0,5.0,6.0
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: May 26, 1999