开发者

How to find broken queries in Access?

开发者 https://www.devze.com 2023-03-29 19:40 出处:网络
How do I find broken queries in access. i.e. Queries that might have broken because the underlying table was deleted or the name of the column in the table changed?

How do I find broken queries in access.

i.e. Queries that might have broken because the underlying table was deleted or the name of the column in the table changed?

Is there an easy way -- rather than just opening开发者_运维问答 each query running and checking if something has gone wrong?


Here are a few notes that may be of interest, depending on your version of Access.

See: GetDependencyInfo Method [Access 2003 VBA Language Reference]

Do not forget that Track name AutoCorrect info is not a good thing, for the most part, but can be useful in certain circumstances.

Dim dinf As DependencyInfo

For j = 0 To CurrentData.AllQueries.Count - 1
    Set dinf = CurrentData.AllQueries(j).GetDependencyInfo

    For i = 0 To dinf.Dependencies.Count - 1
        ''Missing alias, query or table, as far as I can tell
        If dinf.Dependencies.Item(i).Name Like "MISSING:*" Then
            Debug.Print CurrentData.AllQueries(j).Name _
                & "   " & dinf.Dependencies.Item(i).Name
        End If
    Next
Next

You may need to update dependencies:

Application.CurrentProject.UpdateDependencyInfo

This will require a save.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号