Troubleshooting

graphics/troubleshooting.gif

Spaces in ADO Object Names

When I attempt to open a Command object on the views, functions, or stored procedures of NorthwindCS, I receive a "Syntax error or access violation" message.

SQL Server 7.0+ (unfortunately) supports spaces in object names, such as views and stored procedures. However, SQL Server wants these names enclosed within double quotes. Sending double quotes in an object name string is a pain in VBA, but surrounding the object name with square brackets also solves the problem. For example, cnnName. CommandText = "Sales By Year" fails but cnnName. CommandText = "[Sales By Year]" works. Using square brackets for otherwise-illegal object identifiers is the better programming practice.



Special Edition Using Microsoft Office Access 2003
Special Edition Using Microsoft Office Access 2003
ISBN: 0789729520
EAN: 2147483647
Year: 2005
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net