theinviter
Registered User.
- Local time
- Yesterday, 18:33
- Joined
- Aug 14, 2014
- Messages
- 273
Code Tags Added by UG
Please use Code Tags when posting VBA Code
Please read this for further information:-
	
	
		
			
			
				
		
	
@theinviter ----
Please feel free to Remove this Comment
;
;;
;;;
This is not the first time that you have been asked to use code tags
See Here:- https://www.access-programmers.co.uk/forums/threads/copy-record-from-from-to-a-table.314089/
And Here:-
	
	
		
			
			
				
		
	
;
;
x
x
zz
z
z
zz
z
zz
z
z
z
zz
z
zz
z
z
z
z
z
z
z
z
z
zzzz
zz
z
z
z
zzz
z
z
z
zz
zz
z
z
z
z
z
zz
zz
zzz
z
z
z
zz
z
z
z
zz
z
zz
z
zz
z
z
z
z
z
zx
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
xx
x
x
x
x
x
x
x
xx
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
;;;
;
;;;
;;;
;
;;
;;;
;;
;;;
;;;
;;
;;
;
;
;;;
;
;;;
;;;
;
;;
;;;
;;
;;;
;;;
;;
;;
;
;
;;;
;
;;;
;;;
;
;;
;;;
;;
;;;
;;;
;;
;;
;
;
;;;
;
;;;
;;;
;
;;
;;;
;;
;;;
;;;
;;
;;
;
;
;;;
;
;;;
;;;
;
;;
..
...
..
..
..
..
..
.
..
.
..
.
.
.
....
.
..
..
..
.
..
..
.
..
.
..
..
.
.
.
.
.
..
.
..
.
.
.
.
.
..
.
.
.
.
.
;;;
;;
;;;
;;;
;;
;;
;
;
;;;
;
;;;
;;;
	
	
	
		
 Please use Code Tags when posting VBA Code
Please read this for further information:-
Please use Code Tags when posting VBA Code
To make your code easier to read, please use the Code tag around your code, this will ensure that any code you copy and paste from your DB retains it's formatting making it easier to read and follow;  Firstly click on the Code button, that's the button at the top of the posting window with the...
				
					
						
					
					www.access-programmers.co.uk
				
			@theinviter ----
Please feel free to Remove this Comment
;
;;
;;;
This is not the first time that you have been asked to use code tags
See Here:- https://www.access-programmers.co.uk/forums/threads/copy-record-from-from-to-a-table.314089/
And Here:-
Filter subform with call criteria
Dear guys,  Need help,   Code Tags Added by UG Please use Code Tags when posting VBA Code Please read this for further information:- https://www.access-programmers.co.uk/forums/threads/please-use-code-tags-when-posting-vba-code.240420/ Please feel free to Remove this Comment  ; ;; ;;; I draw...
				
					
						
					
					www.access-programmers.co.uk
				
			;
x
x
zz
z
z
zz
z
zz
z
z
z
zz
z
zz
z
z
z
z
z
z
z
z
z
zzzz
zz
z
z
z
zzz
z
z
z
zz
zz
z
z
z
z
z
zz
zz
zzz
z
z
z
zz
z
z
z
zz
z
zz
z
zz
z
z
z
z
z
zx
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
xx
x
x
x
x
x
x
x
xx
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
;;;
;
;;;
;;;
;
;;
;;;
;;
;;;
;;;
;;
;;
;
;
;;;
;
;;;
;;;
;
;;
;;;
;;
;;;
;;;
;;
;;
;
;
;;;
;
;;;
;;;
;
;;
;;;
;;
;;;
;;;
;;
;;
;
;
;;;
;
;;;
;;;
;
;;
;;;
;;
;;;
;;;
;;
;;
;
;
;;;
;
;;;
;;;
;
;;
..
...
..
..
..
..
..
.
..
.
..
.
.
.
....
.
..
..
..
.
..
..
.
..
.
..
..
.
.
.
.
.
..
.
..
.
.
.
.
.
..
.
.
.
.
.
;;;
;;
;;;
;;;
;;
;;
;
;
;;;
;
;;;
;;;
		Code:
	
	
	Dears;
i have a form and there is text field "Find" where i need to filter the record based on the data entered in text field to find in 4 field in the form.
if no result with "Old CODE" then find in next field "New Code "  and other.
i tried this but not working.
On Error GoTo errhandler:
n = 1 / 0 ' cause an error
      Dim strFilter As String
    If Len(Me.FindCode & "") <> 0 Then
        strFilter = "[New Code] Like ""*" & Me.FindCode & "*"" And "
    End If
    If Len(Me.FindCode & "") <> 0 Then
        strFilter = "[Old CODE] Like ""*" & Me.FindCode & "*"" And "
    End If
    If Len(Me.FindCode & "") <> 0 Then
        strFilter = "[Alt Old Code] Like ""*" & Me.FindCode & "*"" And "
    End If
    If Len(Me.FindCode & "") <> 0 Then
        strFilter = "[Alt new Code] Like ""*" & Me.FindCode & "*"" And "
    End If
    If Len(strFilter) <> 0 Then
        strFilter = Left$(strFilter, Len(strFilter) - 5)
        With Me
            .Filter = strFilter
            .FilterOn = True
        End With
    Else
        Me.FilterOn = False
    End If
Exit Sub
errhandler:
' error handling code
Resume Next
End Sub
			
				Last edited by a moderator: 
			
		
	
								
								
									
	
		
			
		
		
	
	
	
		
			
		
		
	
								
							
							 
	 
 
		 
 
		 
			 
 
		
 
 
		 
 
		