End sub.. hvad pokker sker der i denne kode ?
Jeg har fundet denne kode, som jeg synes er genial, men den driller lidt.den siger : Compile error : Expected End Sub
jeg sætter den ind som hændelse på en knap på en form..
kode :
'---------------------------------------------------------------------------------------
' Procedure : DeleteAllQueries
' Author : Daniel Pineault, CARDA Consultants Inc.
' Website : http://www.cardaconsultants.com
' Purpose : Deletes all the queries from the active database
' Copyright : The following may be altered and reused as you wish so long as the
' copyright notice is left unchanged (including Author, Website and
' Copyright). It may not be sold/resold or reposted on other sites (links
' back to this site are allowed).
'
' Revision History:
' Rev Date(yyyy/mm/dd) Description
' **************************************************************************************
' 1 2011-Jun-10 Initial Release
'---------------------------------------------------------------------------------------
Function DeleteAllQueries()
On Error GoTo Error_Handler
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
DoCmd.SetWarnings False
Set db = CurrentDb
For Each qdf In db.QueryDefs
DoCmd.DeleteObject acQuery, qdf.Name
Next
Error_Handler_Exit:
DoCmd.SetWarnings True
Set qdf = Nothing
Set db = Nothing
Exit Function
Error_Handler:
MsgBox "The following error has occurred" & vbCrLf & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Source: DeleteAllQueries" & vbCrLf & _
"Error Description: " & Err.Description, _
vbCritical, "An Error has Occurred!"
Resume Error_Handler_Exit
End Function