Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete AllQueries or AllForms?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Dear Sir:
Base on Security reason, I must delete Allqueries and allforms when some condition. How can I do it? Please reply this question because it's emergency.
Eric Jou
 
you can do a recordset based on MsysObjects:
Dim db As Database, rst As Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("select name,type from msysobjects", dbOpenSnapshot)
Do Until rst.EOF
If rst!Type = 5 Then ' Type 5 query
If Left$(rst!Name, 1) <> &quot;~&quot; Then 'the squiggly is for embedded sql, don't delete
DoCmd.DeleteObject acQuery, rst!Name
End If
ElseIf rst!Type = -32768 Then 'Type -32768 forms
DoCmd.DeleteObject acForm, rst!Name
End If
rst.MoveNext
Loop
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top