SQL syntax error?

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

It looks like its the In statement in your SQL.

Change it to; & " IN ('" & strPath & "') " _

Hope this helps.

Steve.
 
Sorry, I misunderstood :}

Try putting the IN statement after the from statement.

Hope this helps now :)
*Steve places dunces cap on head and stands in corner :)*

Steve.
-----Original Message-----
It looks like its the In statement in your SQL.

Change it to; & " IN ('" & strPath & "') " _

Hope this helps.

Steve.
-----Original Message-----
Hi
I'm trying to write some code that will manipulate
tables
(copy, delete etc)
in my backend from any computer that the frontend is installed on. To do
this the code has to know where the backend is located. I've solved that
one, but I have a problem when I try to use the variable strPath (which
contains the path to the backend) in the SQL string
which
copies a table.
Error message is 'Query input must contain at least one table or query' Is
this caused by a syntax error?

Code is as follows:

'code to get path

Dim db As Database
Dim tdf As TableDef
Dim strCon As String
Dim strPath As String

Set db = CurrentDb()
Set tdf = db.TableDefs("Pupil details")
strCon = tdf.Connect
strPath = Mid(strCon, 11)

Set tdf = Nothing

'create an empty table (named 'Pupil details (new)' in BackEnd database
'by copying the (structure) table

DoCmd.RunSQL "SELECT * " _
& " INTO [Pupil details (new)]" _
& " IN " & strPath _
& " FROM [Pupil details (structure)];"

Thanks

Wesley Kendrick
.
.
 
Back
Top