Guinaba
Board Regular
- Joined
- Sep 19, 2018
- Messages
- 233
- Office Version
- 2016
- Platform
- Windows
Hi guys,
Not sure what I am missing in the SQL statement below. The table has a dynamic name based on the date. I keep getting the error: Syntax error in FROM clause.
Any suggestion?
Not sure what I am missing in the SQL statement below. The table has a dynamic name based on the date. I keep getting the error: Syntax error in FROM clause.
Any suggestion?
VBA Code:
Dim dbs As Database, rst As Recordset, x As Integer
Set dbs = CurrentDb
strTableName = "tb0_AldiDailyScan" & "_" & Date
Set rst = dbs.OpenRecordset("SELECT * FROM " & strTableName)
If Not (rst.EOF And rst.BOF) Then
Do While Not rst.EOF
If rst.Fields(1).Value = "" Then 'Delete blank records
rst.Delete
End If
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Set db = Nothing
End If
End Sub