ClaraBarton
Registered User.
- Local time
- Yesterday, 20:58
- Joined
- Oct 14, 2019
- Messages
- 752
I have a module with a simple routine to position the form to the last record
	
	
	
		
When I call it from the form module it's:
	
	
	
		
But I have a couple routines in the same module that use it also. How do I find the form name?
Would the frm variable carry through? Would you set it at the module level as Private?
There is surely a simple, proper way that I'm missing.
 
		Code:
	
	
	Public Sub RepositionForm(frm As Form)
10    On Error GoTo RepositionForm_Error
      Dim strWhere As String
30            strWhere = "LocID = " & lngLoc
70        frm.Requery
80                With frm.RecordsetClone
90                    .FindFirst strWhere
100               If Not .NoMatch Then
110                   frm.Bookmark = .Bookmark
120               End If
130           End With
         
140       frm![fldItem].SetFocus
150       If Len(frm.fldItem & "") = 0 Then
160           Exit Sub
170       Else: frm.fldItem.SelStart = 0
180           frm.fldItem.SelLength = Len(frm.fldItem)
190       End If
		Code:
	
	
	RepositionForm meWould the frm variable carry through? Would you set it at the module level as Private?
There is surely a simple, proper way that I'm missing.
			
				Last edited: 
			
		
	
								
								
									
	
		
			
		
		
	
	
	
		
			
		
		
	
								
							
							 
	 
 
		 
 
		 
 
		
 
 
		 
 
		 
 
		