Results 1 to 5 of 5
  1. #1
    shenry16 is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    5

    Cursor issue when no records

    I have a form with unbound controls that filter the details portion of the continuous form based on what is entered or selected in these unbound controls. I am having a couple issues with the form in regards to my text boxes and their onchange event. When you type in one of the text boxes to filter the data as you type I am unable to type a space. It just will not let me. On the same level if I enter something that comes back with no records the cursor wont stay at the end of the text. It highlights all the text. Not sure how to fix these issues and have been trying for a couple days now. Below is my code.


    Me.Requery
    stLinkCriteria = ""
    If Not IsNull(Me.BugNumber) Or Not IsNull(Me.Product) Or Not IsNull
    (Me.Importance) Or Not IsNull(Me.Status) Or Not IsNull
    (Me.Resolution) Or Not IsNull(Me.AssignedTo) Or Not IsNull
    (Me.Title) Or Not IsNull(Me.Build) Then
    If Not IsNull(Me.BugNumber) Then
    If stLinkCriteria = "" Then
    stLinkCriteria = "Where IDBug like ""*" & Me.BugNumber & "*"""
    Else
    stLinkCriteria = stLinkCriteria & "and IDBug like ""*" &
    Me.BugNumber & "*"""
    End If
    End If
    If Not IsNull(Me.Product) Then
    If stLinkCriteria = "" Then
    If Me.Product = "NULL" Then
    stLinkCriteria = "Where Product Is Null or Product =''"
    Else
    stLinkCriteria = "Where Product like ""*" & Me.Product &
    "*"""
    End If
    Else
    If Me.Product = "NULL" Then
    stLinkCriteria = stLinkCriteria & "and Product =''"
    Else
    stLinkCriteria = stLinkCriteria & "and Product like ""*" &
    Me.Product & "*"""
    End If
    End If
    End If
    If Not IsNull(Me.Importance) Then
    If stLinkCriteria = "" Then
    If Me.Importance = "NULL" Then
    stLinkCriteria = "Where Risk =''"
    Else
    stLinkCriteria = "Where Risk like ""*" & Me.Importance &
    "*"""
    End If
    Else
    If Me.Importance = "NULL" Then
    stLinkCriteria = stLinkCriteria & "and Risk =''"
    Else
    stLinkCriteria = stLinkCriteria & "and Risk like ""*" &
    Me.Importance & "*"""
    End If
    End If
    End If
    If Not IsNull(Me.Status) Then
    If stLinkCriteria = "" Then
    If Me.Status = "NULL" Then
    stLinkCriteria = "Where Status =''"
    Else
    stLinkCriteria = "Where Status like ""*" & Me.Status & "*"""
    End If
    Else
    If Me.Status = "NULL" Then
    stLinkCriteria = stLinkCriteria & "and Status =''"
    Else
    stLinkCriteria = stLinkCriteria & "and Status like ""*" &
    Me.Status & "*"""
    End If
    End If
    End If
    If Not IsNull(Me.Resolution) Then
    If stLinkCriteria = "" Then
    If Me.Resolution = "NULL" Then
    stLinkCriteria = "Where ResolutionState =''"
    Else


    stLinkCriteria = "Where ResolutionState like ""*" &
    Me.Resolution & "*"""
    End If
    Else
    If Me.Resolution = "NULL" Then
    stLinkCriteria = stLinkCriteria & "and ResolutionState =''"
    Else
    stLinkCriteria = stLinkCriteria & "and ResolutionState like
    ""*" & Me.Resolution & "*"""
    End If
    End If
    End If
    If Not IsNull(Me.AssignedTo) Then
    If stLinkCriteria = "" Then
    If Me.AssignedTo = "NULL" Then
    stLinkCriteria = "Where AssignedTo Is Null or AssignedTo =
    ''"
    Else
    stLinkCriteria = "Where AssignedTo like ""*" &
    Me.AssignedTo & "*"""
    End If
    Else
    If Me.AssignedTo = "NULL" Then
    stLinkCriteria = stLinkCriteria & "and (AssignedTo Is Null or
    AssignedTo = '')"
    Else
    stLinkCriteria = stLinkCriteria & "and AssignedTo like ""*" &
    Me.AssignedTo & "*"""
    End If
    End If
    End If
    If Not IsNull(Me.Title) Then
    If stLinkCriteria = "" Then
    If Me.Title = "NULL" Then
    stLinkCriteria = "Where Title Is Null or Title = ''"
    Else
    stLinkCriteria = "Where Title like ""*" & Me.Title & "*"""
    End If
    Else
    If Me.Title = "NULL" Then
    stLinkCriteria = stLinkCriteria & "and (Title Is Null or Title = '')"
    Else
    stLinkCriteria = stLinkCriteria & "and Title like ""*" & Me.Title &
    "*"""
    End If
    End If
    End If
    If Not IsNull(Me.TestNum) Then
    If stLinkCriteria = "" Then
    If Me.TestNum = "NULL" Then
    stLinkCriteria = "Where TestNumber Is Null or TestNumber =
    ''"
    Else
    stLinkCriteria = "Where TestNumber like ""*" & Me.TestNum
    & "*"""
    End If
    Else
    If Me.TestNum = "NULL" Then
    stLinkCriteria = stLinkCriteria & "and (TestNumber Is Null or
    TestNumber = '')"
    Else
    stLinkCriteria = stLinkCriteria & "and TestNumber like ""*" &
    Me.TestNum & "*"""
    End If
    End If
    End If
    If Not IsNull(Me.Build) Then
    If stLinkCriteria = "" Then
    If Me.Build = "NULL" Then
    stLinkCriteria = "Where Build Is Null or Build = ''"
    Else
    stLinkCriteria = "Where Build like ""*" & Me.Build & "*"""
    End If
    Else
    If Me.Build = "NULL" Then
    stLinkCriteria = stLinkCriteria & "and (Build Is Null or Build =
    '')"
    Else
    stLinkCriteria = stLinkCriteria & "and Build like ""*" &
    Me.Build & "*"""
    End If
    End If
    End If
    Me.RecordSource = "Select * from qryBugSearch " & stLinkCriteria
    ElseIf Not IsNull(Me.TestNum) Then
    If Me.TestNum = "Null" Then
    Me.RecordSource = "Select * from qryBugSearch where
    TestNumber Is Null Or TestNumber = ''"
    Else
    Me.RecordSource = "Select * from qryBugSearch where
    TestNumber like ""*" & Me.TestNum & "*"""
    End If
    Else
    Me.RecordSource = "qryBugSearch"
    End If
    If Me.btnHideShowApp.Caption = "SHOW" Then
    Form.Filter = "BugMain.Status <> """ & "Approved" & """ or
    BugMain.Status Is Null"
    Me.FilterOn = True
    End If
    TestNum.SetFocus
    TestNum.SelStart = TestNum.SelLength

  2. #2
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    No being able to enter data in a text box can be the result of many thing, incorrectly bound to the wrong datatype is a big one.

    Try using a a breakpoint to single step through you code to see if it's a code issue? I doubt that it is.

  3. #3
    shenry16 is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    5
    I can enter data in the text box. Please reread what the issue is and I have stepped through it, but no luck figuring out what the issue is. The text box I filter with is an unbound text box and the code behind that text box is listed above to filter the form.

  4. #4
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    There is an Access option which sets the behavior of the cursor ob entering a field: Select entire field, goto start of field & goto end of field.

    You code is overly complex, I'm not going to wade through that. However, if a field is null, that field is not being filtered, unless you really mean to filter for a Null, which I doubt.

    I have no explanation for not being able to enter a space in an unbound field, but suspect an invalid mask.

  5. #5
    shenry16 is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    5
    Thanks! I found the option you mentioned in the options keyboard section and changed it to end of text and it works!!! So this is solved now if I can only get the space bar to space when filtering as I type.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Need help with date issue.
    By ITChevyUSSNY in forum Reports
    Replies: 13
    Last Post: 02-05-2013, 10:06 AM
  2. Primary Key Issue
    By Ciwan in forum Access
    Replies: 5
    Last Post: 10-23-2009, 10:04 PM
  3. Count records issue
    By EstesExpress in forum Forms
    Replies: 1
    Last Post: 09-29-2009, 12:24 PM
  4. Speed issue
    By hey23 in forum Queries
    Replies: 1
    Last Post: 06-24-2009, 09:16 AM
  5. Replies: 0
    Last Post: 03-26-2007, 12:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums