Hi
My problem is with regards executing a sql string from vb. I created a table in Access and its content will change over time but a copy of what is currently in the table is needed so i created a make table query in access that works fine.
I was going to name the table passed on the current date in VB by passing a date variable to a string i created that holds the string before the INTO part of the SELECT stmt. The problem is the value of the string is in single quotes '' and Access won't let me create the table since it says this is a syntax error. Does anyone know a work around for this.
Following is my basic code:
SQL2 = "SELECT GSInf.UniqueID, GSInf.CMName, GSInf.Type, GSInf.Day, GSInf.Finish INTO " + "'" & today & "'" + " FROM GSInf;"
SQL2 is the string for holding my sqlstmt and today is a date variable i created. I tried changing the type of date variable to string,long,integer but it still gave me a syntax error.
I'm executing the stmt using the connection1.execute where connection is my connection object and it works fine if there is no variable there and i just concatentate to the string but with the introduction of variables the quotes are causing problems. If you have any ideas i would appreciate hearing them.
Thanks
My problem is with regards executing a sql string from vb. I created a table in Access and its content will change over time but a copy of what is currently in the table is needed so i created a make table query in access that works fine.
I was going to name the table passed on the current date in VB by passing a date variable to a string i created that holds the string before the INTO part of the SELECT stmt. The problem is the value of the string is in single quotes '' and Access won't let me create the table since it says this is a syntax error. Does anyone know a work around for this.
Following is my basic code:
SQL2 = "SELECT GSInf.UniqueID, GSInf.CMName, GSInf.Type, GSInf.Day, GSInf.Finish INTO " + "'" & today & "'" + " FROM GSInf;"
SQL2 is the string for holding my sqlstmt and today is a date variable i created. I tried changing the type of date variable to string,long,integer but it still gave me a syntax error.
I'm executing the stmt using the connection1.execute where connection is my connection object and it works fine if there is no variable there and i just concatentate to the string but with the introduction of variables the quotes are causing problems. If you have any ideas i would appreciate hearing them.
Thanks