Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 7th, 2004, 02:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default Select Statement syntax

Hi Guys,

How can I write the select statement on a table name that has spaces in between? I am using an ACCESS Database

Example:

SQLString = "Select * from Look Up Table"

I am getting an error message after the word "look". I tried :

SQLString = "Select * from" & " " & "Look" & " " & "Up" & " " & "Table"

SQLString = "Select * from " & "Look " & "Up " & "Table"

I still get the same error message. The only thing I did to make it work was to rename the table to Look_Up_Table. After renaming it the program I wrote worked. I would like to find out if there is a way that I can use the program that I wrote without renaming the table name.

Thanks,
Judy

Can someone please help me

 
Old July 7th, 2004, 02:48 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Dear judy you can use this queery

SELECT * FROM [Look Up Table]

Love 4 all
 
Old July 12th, 2004, 08:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quick answer: as qazi_nomi says, enclose the table name with brackets [ ].

Preachy answer: don't use spaces in table names, query names, report names, field names. Use either an underscore for a space or use upper/lower case to make the name readable. For example:

My_table_name
MyTableName


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
Select from another select statement to a repeater simsen ASP.NET 2.0 Professional 0 May 2nd, 2007 04:34 PM
NEED HELP INSERT INTO statement syntax error koco ASP.NET 1.0 and 1.1 Basics 6 June 2nd, 2006 04:01 PM
"Syntax error in INSERT INTO statement" jtmerchant Classic ASP Databases 1 April 12th, 2006 02:30 PM
syntax of xsl:if statement EstherMStrom XSLT 3 February 14th, 2005 05:47 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.