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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My field name is 'domain' - SQL Query errors 1

Status
Not open for further replies.

worldwise

Programmer
Jun 1, 2005
112
US
Hi,

I have an ASP site using a MS Access backend with a field named 'domain'. I guess this must be a reserved word/keyword because I'm running into problems when running a query on the DB.

SELECT * FROM myTable WHERE domain = 'blah'

the error that comes back is: Unspecified Error.

I thought it might help to quantify the field by going: myTable.domain but I get the same error.

Is there any workaround? I have already built many pages using this field so changing the field name from 'domain' is really not an option.

Thank you,

-Kevin
 
And this ?
SELECT myTable.* FROM myTable WHERE myTable.domain = 'blah'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
No luck. I still get the error.

Thanks for the quick response PHV.
 
Try
SELECT * FROM myTable WHERE [domain] = 'blah'


Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Kevin,

I just changed a field name in an access table to domain and ran the following without error:

Code:
SELECT *
FROM tblCust
WHERE domain="ARIMA";

Now that's all within a single DB, but it makes me wonder if there may be another cause for the error. Have you tried replacing domain with another field name where you're sure it wouldn't be a reserved word?



John

Use what you have,
Learn what you can,
Create what you need.
 
BoxHead,

Yes, when I use other fields as a search critiera (WHERE someTable = 'blah') then it works without error. Its just when I use the domain field.



dhookom, i will try the [domain] thing right now.

thx,

kevin
 
dhookmon,

THANK YOU. It worked when I used the square brackets []. What is the effect of using the square brackets?

To everyone else who posted, thank you very much for your input! It was all very helpful.

-Kevin
 
It's just typical to use some "delimiter" when using reserved words as object or field names. If your field names contains spaces, you need to use []s.


Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top