Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to open table with space in name

Status
Not open for further replies.

MrGunner

Programmer
Sep 3, 2001
8
US
I am having some trouble opening up a table with a space in the name.

Here's an example of what I'm doing...

Dim db As Database
Dim rsTT As Recordset
Set db = OpenDatabase(strPath)
Dim strSQL As String
strSQL = "select * from " & tbName & " where ID = " & ID
Set rsTT = db.OpenRecordset(strSQL)

I'm taking in a table name (tbName) and trying to first open up the database. It works ok if the table names are like... ranks, information, members, etc... but if there is a space in the name like... client info ... then it does't open up.

Is there a way I can open that table up with the space in the name?

 
Step one: Go abuse the person who created a table with a space in the name. (really bad practice).

Step two: Surround the table name with either double-quotes or square-brackets
[tt]
strSQL = "select * from [" & tbName & "] where ID = " & ID
[/tt]

Chip H.
 
Hey, thanks for the help...

I'll have to raz my friend for his database design ( I have no clue why he even put spaces in it).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top