Hi:
The function below deletes a specific table with the user supplying the table name, and deletes it if it does. But the function returns an error "table not found" if the table name has a space in it. How can I get it to accept the space? Thanks for the help in advance.
Function DeleteTables(sTableName As String)
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Set dbs = CurrentDb()
DoCmd.SetWarnings False
For Each tdf In dbs.TableDefs
If tdf.Name = sTableName Then
CurrentDb.Execute "DROP TABLE " & sTableName
The function below deletes a specific table with the user supplying the table name, and deletes it if it does. But the function returns an error "table not found" if the table name has a space in it. How can I get it to accept the space? Thanks for the help in advance.
Function DeleteTables(sTableName As String)
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Set dbs = CurrentDb()
DoCmd.SetWarnings False
For Each tdf In dbs.TableDefs
If tdf.Name = sTableName Then
CurrentDb.Execute "DROP TABLE " & sTableName