I've been a bit curious about the time taken for various ways of calling a sub / function where a particular form is involved.
I've tested this over 10000000 iterations with the results below.
In the first test I passed the form name as "Me"
	
	
	
		
It took 1.85 seconds to run.
In the second test I used "Screen.activeform"
	
	
	
		
This took 39.5 seconds to run, that is about 21 times slower than passing "Me".
As a matter of interest, I tried the first test with While / Wend and it took 1.9 seconds.
Just thought I'd let you know.
 I've tested this over 10000000 iterations with the results below.
In the first test I passed the form name as "Me"
		Code:
	
	
	Private Sub timeTest()
    Dim nNum As Long
    nStart As Double
    nNum = 1
    nStart = timeGetTime
    Do
        nNum = addone(nNum, Me)
    Loop While nNum < 10000000
    Me.txtname = timeGetTime - nStart
End Sub
Private Function addone(nNum As Long, frm As Form) As Long
    addone = nNum + 1
End FunctionIt took 1.85 seconds to run.
In the second test I used "Screen.activeform"
		Code:
	
	
	Private Sub timeTest()
    Dim nNum As Long
    nStart As Double
    nNum = 1
    nStart = timeGetTime
    Do
        nNum = addone(nNum)
    Loop While nNum < 10000000
    Me.txtname = timeGetTime - nStart
End Sub
Private Function addone(nNum As Long) As Long
    Dim frm As Form
    Set frm = Screen.ActiveForm
    addone = nNum + 1
End FunctionThis took 39.5 seconds to run, that is about 21 times slower than passing "Me".
As a matter of interest, I tried the first test with While / Wend and it took 1.9 seconds.
Just thought I'd let you know.
			
				Last edited: 
			
		
	
								
								
									
	
		
			
		
		
	
	
	
		
			
		
		
	
								
							
							 
	 
 
		