<P>Here is some code that can be useful for letting you know which queries use a certain table. Cut and past this into a module.<BR><BR><B><FONT color=green><BR>Option Compare Database<BR>Option Explicit<BR><BR>Sub findtbls()<BR>FindAllQueriesThatContainASpecifiedTable ("MyTableNameHere")<BR>End Sub<BR> <BR>Public Function FindAllQueriesThatContainASpecifiedTable(tblName As String)<BR> Dim qd As QueryDef<BR> Dim DB As Database<BR> Dim tb As TableDef<BR> Dim rsQueries As Recordset, RS As Recordset<BR> Dim sqlStr As String<BR> Dim index As
Integer<BR> Set DB = CurrentDb()<BR> Set tb = DB.CreateTableDef("tempTblDef") 'create temp table<BR> sqlStr = "SELECT QueryName FROM " & tb.name & " WHERE ((([QuerySQL]) LIKE '*" & tblName & "*'))"<BR> <BR> tb.Fields.Append tb.CreateField("QueryName", dbText) 'add fields we need<BR> tb.Fields.Append tb.CreateField("QuerySQL", dbMemo)<BR> DB.TableDefs.Append tb<BR> <BR> Set RS =
tb.OpenRecordset() 'open the table!<BR> <BR> For Each qd In DB.QueryDefs 'get sql and name of each query, ignoring<BR> If (Left(qd.name, 1) <> "~") Then 'system and hidden queries<BR> RS.AddNew<BR> RS!QueryName = qd.name<BR> RS!QuerySQL = qd.SQL<BR> Debug.Print
RS!QueryName<BR> RS.Update<BR> End If<BR> Next<BR> RS.close<BR> <BR> 'open up a recordset based on the temp table using a SQL query<BR> Set rsQueries = DB.OpenRecordset(sqlStr)<BR> rsQueries.MoveLast: rsQueries.MoveFirst<BR> <BR> 'print out the resuls of our query<BR> Debug.Print "------ Queries containing table '" & tblName & "' -------"<BR> Debug.Print "------ number of queries : " & rsQueries.RecordCount<BR> For index = 1 To rsQueries.RecordCount Step 1<BR> Debug.Print
rsQueries!QueryName<BR> rsQueries.MoveNext<BR> Next<BR> <BR> rsQueries.close 'get rid of it!<BR> DB.TableDefs.Delete tb.name 'delete temp. tabledef<BR> Set DB = Nothing<BR>End Function<BR></FONT></B></P><BR><BR><DIV>
<DIV>
<P align=center><STRONG>Lonnie Johnson<BR></STRONG><STRONG>ProDev</STRONG>, Professional Development of MS Access Databases<BR>Visit me at ==> <A href="http://www.prodev.us/">http://www.prodev.us</A></P>
<P><BR><A href="http://www.galaxymall.com/software/PRODEV"><BR></A><BR> </P></DIV></DIV><p><hr SIZE=1>
Do you Yahoo!?<br>
<a href="http://us.rd.yahoo.com/evt=10469/*http://sitebuilder.yahoo.com">Yahoo! SiteBuilder</a> - Free, easy-to-use web site design software