I am playing with some new code below to log the time that it takes to run a query.
So i have added a new function called Startlog and EndLog.
I want these to use the function name as i log this in my table, is there a easy way to pass the Function name to StartLog and EndLog so i dont have to type in all the time ?
So i have added a new function called Startlog and EndLog.
I want these to use the function name as i log this in my table, is there a easy way to pass the Function name to StartLog and EndLog so i dont have to type in all the time ?
Code:
Function OpenAuditsNoUser()
WarningsOff
StartLog ("OpenAuditsNoUser")
DoCmd.OpenQuery "Qry_Update Date for Closed jobs"
ExportQuery "Open Audits", "SELECT * FROM Qry_Open_Audits;", , , Environ("Temp") & "\"
EndLog ("OpenAuditsNoUser")
Waitoff
End Function
Code:
Function StartLog(myReport)
WarningsOff
sUser = GetLongName
strsql = ("INSERT INTO tblqcreports ([User], [StartTime],[Report]) VALUES ( '" & GetLongName& "', '" & stime & "', '" & myReport & "');")
DoCmd.RunSQL strsql
WarningsOn
End Function
Function EndLog(myReport)
WarningsOff
strsql = "UPDATE tblqcreports SET tblqcreports.EndTime = Now()" & "WHERE tblqcreports.Report='" & myReport & "' AND tblqcreports.Endtime Is Null;"
DoCmd.RunSQL strsql
WarningsOn
End Function