Forums
This topic is locked
create recordset from table name with spaces
Posted 11 Nov 2005 00:34:14
1
has voted
11 Nov 2005 00:34:14 Dawn Messier posted:
I'm creating ASP/VB web pages connecting to an Access database. The database is huge, 2 years old and created long before my time. It was designed as a database with its own Access interface. I want to use the data portion of it and create an easy-to-use webpage interface for it. But some of the table names have spaces in them. To remove spaces and change table names would disrupt the existing workings of the Access database. Is there any way I can refer to the name of the table WITH spaces so I can avoid any complications?<font color=red><pre id=code><font face=courier size=2 id=code>set rs=Server.CreateObject("ADODB.recordset"
rs.Open "SELECT EmpCode,LastName,FirstName FROM Employee TBL WHERE Status = 'Active' Order BY LastName ", conn</font id=code></pre id=code></font id=red>
Replies
Replied 11 Nov 2005 17:19:43
11 Nov 2005 17:19:43 myke black replied:
all you need to do is surround your table or field names with square brackets like this:
set rs=Server.CreateObject("ADODB.recordset"
rs.Open "SELECT EmpCode,LastName,FirstName FROM [Employee TBL] WHERE Status = 'Active' Order BY LastName", conn
set rs=Server.CreateObject("ADODB.recordset"
rs.Open "SELECT EmpCode,LastName,FirstName FROM [Employee TBL] WHERE Status = 'Active' Order BY LastName", conn
Replied 11 Nov 2005 19:43:51
11 Nov 2005 19:43:51 Dawn Messier replied:
I knew it was something that simple! Thanks so much!