Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2006

    Unanswered: Find what queries ref a colm?

    I have inherited a poorly documented db. Is there any way i can find what queries have a where clause on a specific column in a table and also what reports are based on these queries?

  2. #2
    Join Date
    Apr 2004
    outside the rim
    something like this perhaps:
    Sub SearchQueries
    Dim qryDef As DAO.QueryDef
    Dim qryDefs As DAO.QueryDefs
    Dim strSQL As String
    Dim strField As String
    Set qryDefs = CurrentDB.QueryDefs
    strField = "TheFieldName"
    For Each qryDef In qryDefs
        strSQL = qryDef.SQL
        If InStr(1,strSQL,strField) > 0 Then
            ... Do Something, qryDef.Name has the query's name for example
        End If
    Set qryDef = Nothing
    Set qryDefs = Nothing
    Exit Sub
    WARNING: This is "Air Code" - it may have a typo or two. Also, I used DAO objects - if you have Access 2K or newer, you'll need to add the DAO reference.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts