Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004

    Question Unanswered: On Change problem

    I have an unbound form (frmProjectList). On the form, there are five unbound text boxes (ProjectID, ProjectName, ClientName, Manager, AdminLocation) that I am trying to use to update a subform (fsubProjectList). The subform is bound to a query (qryProjectList). I have set up criteria in the query to pull from the main form, where the criteria for the fields are as follows:
    Field: [project_id], Criteria: Like "*" & [Forms]![frmProjectList]![ProjectID] & "*"
    Field: [project_name], Criteria: Like "*" & [Forms]![frmProjectList]![ProjectName] & "*"
    Field: [client_name], Criteria: Like "*" & [Forms]![frmProjectList]![ClientName] & "*"
    Field: [Manager], Criteria: Like "*" & [Forms]![frmProjectList]![Manager] & "*"
    Field: [location], Criteria: Like "*" & [Forms]![frmProjectList]![AdminLocation] & "*"

    I have set up On Change events for each of the five unbound text boxes on frmProjectList using the following:


    What I was hoping for was after each character entered on any of the form text boxes, the subform would requery and the list of projects would narrow down to just list the projects with the specified criteria. The On Change is not updating like I thought it would though. If I enter something in one of the text boxes, I the subform does not requery right away. I can leave the text box, come back, and change the data again and it finally requeries.

    How can I set this up so that after each character entered in any of the five unbound text boxes the subform requeries?

  2. #2
    Join Date
    Apr 2004
    Derbyshire, UK
    Provided Answers: 2

    On investigation it would appear that the textbox change event fires before any updating of the control text value. If you put a MsgBox to print the textbox value in the OnChange event you will see what I mean!!

    Therefore I don’t think you can do what you want to do!!


  3. #3
    Join Date
    Nov 2004
    MTB, you inspired me. I have modified my On Change event code as follows:

    Me.ClientCode.SelStart = Me.ClientCode.SelLength

    The refresh gets my timing better tuned and the second line returns my cursor to the end of the text. End result = IT WORKS!

    Thanks for your observations!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts