• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 468
  • Last Modified:

Access Macro Delete Wildcard

In using a Macro, list item "DeleteObject," is there  a way to indicate a Table Name with a Wildcard?  More specifically, I would like to delete the error tables that begin with the Prefix:

'Fail Active$'

(I attempted with 'Fail* - unsuccessfully)

The only thing that changes is the extension (number of error tables). That is, can I delete more than one table at once from a DeleteObject, using a Wildcard for the prefix.

Thanks.
0
tahirih
Asked:
tahirih
  • 2
1 Solution
 
Patrick MatthewsCommented:
Hello tahirih,

No, but if you enumerate the TableDefs collection, you can test each Name, and if the Name matches a prefix
delete the table...

For Each td In CurrentDb.TableDefs
    If td.Name Like "Fail*" Then
        'code
    End If
Next

Regards,

Patrick
0
 
tahirihAuthor Commented:
this is a simple question, but clarification is appreciated.

can i place this code in the Macro Design window - i.e. the actual steps of doing this...thanks.

Thanks.
0
 
tahirihAuthor Commented:
Thanks
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now