Question Locked

Access columns

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Can anyone tell me, can you use special characters in an access db column? ie. / or - etc.

6 replies

by jdclyde

what is it you have in mind?

which characters and why? part of a descriptor?

If nothing else, consider this a bump.

B-)

by jiminpa

I'm sure there is a better cleaner way to do what I'm doing but since it needs to be done yesterday, (doesn't it always) I'm going with what I know. I am writing a web app to sign users up for end user training. The way I have everything set up in the last step behind the scenes based on user input I have an insert statement running that looks like this.

INSERT INTO ROSTER (8/06/2008SUPER_USER) VALUES ('John Smith')

I have a column in my database called 8/06/2008SUPER_USER

for the record if I take the slashes out and hard code a statement that doesn't work either but I just want to make sure before I get too much further that I can use special characters. I know in some instances a slash is an escape character so that's why I want to know if I can use a dash. The way the date looks in the column is the way the date will present to the end user so I want to make it as clean as possible for them.

by maevinn

Put [ ] around the column name in the query string, unless you can easily rename the column. Dashes would be acceptable.

by jiminpa

both adding brackets and changing the column name to include dashes instead of slashs. Still no luck. If it helps I've included the relevant part of the code below. Thoughts?

Dim cmd As New OleDbCommand("INSERT INTO ROSTER (8-04-2008SUPER_USER) VALUES ('Jim Test')", Conn)
Conn.Open()
cmd.ExecuteNonQuery()
Conn.Close()

by maevinn

Is this coming from an html page? Have you verified that it's making the connection to the database? What error message is it giving you?

This discussion is closed to new replies.