troubleshooting Question

Invalide use of prprty on

Avatar of João serras-pereira
João serras-pereiraFlag for Portugal asked on
Microsoft AccessVBA
1 Comment1 Solution32 ViewsLast Modified:
Hi

On my app I need to select a subset of records from which it depends. Sou created a filter field, in the form, and, on mouse up I pretend to filter and refres

But I am consistently getting an error wen I put Me. filter On (or with the extended syntax...)

my code is:


Private Sub fld_locateUser_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)


   
    Dim strUserID As String, _
        strUserTipo As String
        
        

'Me.Filter = "[LastName] Like '*" & [ControlName] & "*'"
'Me.FilterOn = True


On Error GoTo errorTrap
    
    Call logMe("fld_locateUser_MouseUp frm_selecaoPatrons", "start")
    Forms!frm_selecaoPatrons.Filter = "[cellphone] Like '*" & [fld_locateUser] & "*' or [full_name] Like '*" & [fld_locateUser] & "*'"
    Forms!frm_selecaoPatrons.FilterOn
    Forms!frm_selecaoPatrons.Requery
    Forms!frm_selecaoPatrons.Repaint

    Call logMe("Form_Close frm_selecaoPatrons", "end")
    Exit Sub
    
errorTrap:
    If Err.Number <> 2501 Then
        MsgBox "[Form_Close frm_selecaoPatrons errorTrap]." & _
                "[" & Err.Number & "].[" & Err.Description & "]"
        Call logMe("frm_selecaoPatrons errortrap", _
                    "[Form_Close frm_gestaoPatrons]." & "[" & _
                    Err.Number & "].[" & Err.Description & "]")
    End If
    Resume Next
    

End Sub

Private Sub Form_Close()

   
    Dim strUserID As String, _
        strUserTipo As String

On Error GoTo errorTrap
    
    Call logMe("Form_Close frm_selecaoPatrons", "start")
    DoCmd.OpenForm "frm_enviarUnicoSMS"
    Call logMe("Form_Close frm_gestaoPatrons", "end")
    Exit Sub
    
errorTrap:
    If Err.Number <> 2501 Then
        MsgBox "[Form_Close frm_selecaoPatrons errorTrap]." & _
                "[" & Err.Number & "].[" & Err.Description & "]"
        Call logMe("frm_gestaoPatrons errortrap", _
                    "[Form_Close frm_selecaoPatrons]." & "[" & _
                    Err.Number & "].[" & Err.Description & "]")
    End If
    Resume Next
    
End Sub

Screenshot-2020-04-17-at-17.07.47.png
can anyone help?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros