Solved

Unbound Object seems to "requery and makes data entry cumbersome

Posted on 2013-07-01
2
407 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39292045
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
ID: 39295531
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Outlook Free & Paid Tools
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

789 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