Solved

Unbound Object seems to "requery and makes data entry cumbersome

Posted on 2013-07-01
2
374 Views
Last Modified: 2013-07-02
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
Comment
Question by:rogerdjr
2 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
Comment Utility
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
 

Author Closing Comment

by:rogerdjr
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now