Dear All,
I get run time error 3450 "Syntax Error in Query, Incomplete Query clause" when running the code below at the highlighted line.
Actually, I am trying to reference table names on a table on the local Db, then open those tables on a remote Db. I guess I get it wrong some where. I need help please .
Dim DBsr As Database
Dim rstReg As Recordset
Dim rstLTL As Recordset
Dim boMails As Boolean
Dim strTable As String
Dim RegFile As String
Dim strReg As String
'Firstly get the list of tables to be updated
Set Dbs = CurrentDb()
Set rstLTL = Dbs.OpenRecordset("SELECT *FROM tblUpdate ") 'get list of tables to be updated
While (Not (rstLTL.EOF))
'get registrars list
Set rstReg = Dbs.OpenRecordset("SELECT *FROM tblRegStatus ")
While (Not (rstReg.EOF))
strReg = rstReg("Reg")
RegFile = "C:\Apps\Retreat\Program Manager V2.0\Users\Public\Documents\PRA\Regclient" & strReg & "\Data.accdb"
Set DBsr = OpenDatabase(RegFile)
With rstLTL
strTable = rstLTL("Table_Name")
DBsr.Execute "DELETE * FROM '" & strTable & "' "
End With
rstReg.MoveNext
Wend
rstReg.Close
DBsr.Close
rstLTL.MoveNext
Wend
rstLTL.Close
I get run time error 3450 "Syntax Error in Query, Incomplete Query clause" when running the code below at the highlighted line.
Actually, I am trying to reference table names on a table on the local Db, then open those tables on a remote Db. I guess I get it wrong some where. I need help please .
Dim DBsr As Database
Dim rstReg As Recordset
Dim rstLTL As Recordset
Dim boMails As Boolean
Dim strTable As String
Dim RegFile As String
Dim strReg As String
'Firstly get the list of tables to be updated
Set Dbs = CurrentDb()
Set rstLTL = Dbs.OpenRecordset("SELECT *FROM tblUpdate ") 'get list of tables to be updated
While (Not (rstLTL.EOF))
'get registrars list
Set rstReg = Dbs.OpenRecordset("SELECT *FROM tblRegStatus ")
While (Not (rstReg.EOF))
strReg = rstReg("Reg")
RegFile = "C:\Apps\Retreat\Program Manager V2.0\Users\Public\Documents\PRA\Regclient" & strReg & "\Data.accdb"
Set DBsr = OpenDatabase(RegFile)
With rstLTL
strTable = rstLTL("Table_Name")
DBsr.Execute "DELETE * FROM '" & strTable & "' "
End With
rstReg.MoveNext
Wend
rstReg.Close
DBsr.Close
rstLTL.MoveNext
Wend
rstLTL.Close