Modify the frmCriteria form by giving it a custom property of type Long and called TimesOpened . Then you should try to write some code that increments the value of this new property whenever the form is opened.
The Kernel32 dynamic link library contains a function called GetWindowsDirectory which returns the path to the Windows directory. You can declare the function like this in VBA:
Private Declare Function GetWindowsDirectoryA Lib "kernel32" _ (ByVal strBuffer As String, ByVal lngSize As Long) As Long
The first argument should be passed as a fixed-length string and will be populated by the function with a string representing the path to the Windows directory. You should populate the second variable ( lngSize ) with the length of strBuffer before you call the GetWindowsDirectory function. The GetWindowsDirectoryA function returns a long integer denoting the length (max. 255 ) of the value it has placed in strBuffer .
Use this function to create a VBA procedure called GetWinDir that accepts no arguments and simply returns the path to the Windows directory.
What is the difference between, and effect of, passing an argument ByVal & ByRef ?
What is the default method of passing an argument in VBA?