Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 440
  • Last Modified:

Unbound Object seems to "requery and makes data entry cumbersome

I have an ubound object I use to Incrementally search as I enter data.

The code I use is shown below. As I type in a number the cursor jumps back to the beginning of the field.

Anybody have an idea what could cause this strange behavior?

Private Sub PcoNoSearch_Change()
    Dim PcoSearchFilter As String, PcoSearchTxtVal As Double
    If Not IsNull(Me![PcoNoSearch].Text) And Me![PcoNoSearch].Text <> "*.*" Then
            PcoSearchFilter = "[ChngPropNo] like " & """" & "*" & Me![PcoNoSearch].Text & "*" & """" & " And " & "[ContractId] = " & """" & Me![CurCntrId] & """"
        Else
            PcoSearchFilter = ""
    End If
   
    Forms![0_masterdatafrm]![01_WkgChngProposalSimpleFrm].Form.Filter = PcoSearchFilter
    Forms![0_masterdatafrm]![01_WkgChngProposalSimpleFrm].Form.FilterOn = -1
End Sub
0
rogerdjr
Asked:
rogerdjr
1 Solution
 
Rey Obrero (Capricorn1)Commented:
test this


Private Sub PcoNoSearch_Change()
    Dim PcoSearchFilter As String, PcoSearchTxtVal As Double, str
    str = str & Me.[PcoNoSearch].Text
'    If Not IsNull(Me![PcoNoSearch].Text) And Me![PcoNoSearch].Text <> "*.*" Then
'            PcoSearchFilter = "[ChngPropNo] like " & """" & "*" & Me![PcoNoSearch].Text & "*" & """" & " And " & "[ContractId] = " & """" & Me![CurCntrId] & """"
'        Else
'            PcoSearchFilter = ""
'    End If

     PcoSearchFilter = "[ChngPropNo] Like '*" & str & "*' And [ContractId] = " & Me.[CurCntrId]
   
   'if [ContractId] is Text Data, use below
   '  PcoSearchFilter = "[ChngPropNo] Like '*" & str & "*' And [ContractId] = '" & Me.[CurCntrId] & "'"
   
   
    Forms![0_masterdatafrm]![01_WkgChngProposalSimpleFrm].Form.Filter = PcoSearchFilter
    Forms![0_masterdatafrm]![01_WkgChngProposalSimpleFrm].Form.FilterOn = -1
End Sub
0
 
rogerdjrAuthor Commented:
This is the code I ended up with

Thanks

-------------------
Private Sub PcoNoSearch_Change()
    Dim PcoSearchFilter As String, PcoSearchTxtVal As Double
    If Not IsNull(Me![PcoNoSearch].Text) And Me![PcoNoSearch].Text <> "*.*" Then
            PcoSearchFilter = "[ChngPropNo] like " & """" & "*" & Me![PcoNoSearch].Text & "*" & """" & " And " & "[ContractId] = " & """" & Me![CurCntrId] & """"
        Else
            PcoSearchFilter = ""
    End If

    Forms![0_masterdatafrm]![01_WkgChngProposalSimpleFrm].Form.Filter = PcoSearchFilter
    Forms![0_masterdatafrm]![01_WkgChngProposalSimpleFrm].Form.FilterOn = -1
   
    SendKeys "{end}"

End Sub
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now