Trying to get the below code to iterate through all the tables in my db and delete any tables that begin with "str_arch_chk".
The problem is that it looks as if the wildcard "*" is being treated literally. So, not sure what to use for the wildcard? Or if I need to write the code differently?
Any suggestions are appreciated..thanks!
Function fcn_tbl_delete_all_str_arch_chk_tbls()
Dim str_arch_chk As String
Dim t As TableDef
Dim db As DAO.Database
Set db = CurrentDb
str_arch_chk = "str_arch_chk_tbl_temp_2"
Dim str_arch_chk_var As String
str_arch_chk_var = Left(str_arch_chk, 12) & "*"
For Each t In db.TableDefs
If fcn_tbl_exists(str_arch_chk_var) Then
DoCmd.DeleteObject acTable, str_arch_chk
End If
Next
End Function
Function fcn_tbl_exists(str_tbl_name)
'checks to see if a table exists..
Dim d As Database
Dim tdf As TableDef
On Error Resume Next
Set d = CurrentDb
Set tdf = d.TableDefs(str_tbl_name)
If Err = 3265 Then
fcn_tbl_exists = False
Else
fcn_tbl_exists = True
End If
Err = 0
End Function