Try This
Function LoopThruTables()
Dim db as Database, tdf as TableDef
Set db= CurrentDb
For Each tdf in db.TableDefs
( Code to execute what ever)
Next
End Function
You could also vinclude this code in a Sub routine
Rosco
> How do I convert this code to loop thru tables (instead of forms)?
>
[quoted text clipped - 7 lines]
>
> Ross
The code does not convert simply, as there is no Tables collection like the
Forms collection.
You could:
- get a list of the tables from the TableDefs collection,
- use the function below to see if it is open, and if so,
- close it with DoCmd.Close
Function IsLoaded(strName As String, _
Optional ObjType As AcObjectType = acForm) As Boolean
' Returns True if the specified object is open.
IsLoaded = (SysCmd(acSysCmdGetObjectState, ObjType, strName) <> 0)
End Function

Signature
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
> How do I convert this code to loop thru tables (instead of forms)?
>
[quoted text clipped - 7 lines]
>
> Ross