How to filter a field based on the other fields in the form?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jaishu
    New Member
    • Mar 2007
    • 22

    How to filter a field based on the other fields in the form?

    Hi,

    I have a form where user enters an ID in a text box, the ID is actually 10 digits, but even if the user enters 5-6 digits , my code is supposed to pick tht and based on tthis it should populate a combobox with all relative products( product IDs). how do i do this ?

    Code:
    Form.RecordSource = "Select * from table1"
    Form.Filter = "ID='" & User entered id& "'"
    Form.FilterOn = True
    What is that i m supposed to specify (equivalent to the Sql syntax LIKE)???
    in the second line how do i specify it?

    Thanks so much in advance!!
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by jaishu
    Hi,

    I have a form where user enters an ID in a text box, the ID is actually 10 digits, but even if the user enters 5-6 digits , my code is supposed to pick tht and based on tthis it should populate a combobox with all relative products( product IDs). how do i do this ?

    Code:
    Form.RecordSource = "Select * from table1"
    Form.Filter = "ID='" & User entered id& "'"
    Form.FilterOn = True
    What is that i m supposed to specify (equivalent to the Sql syntax LIKE)???
    in the second line how do i specify it?

    Thanks so much in advance!!
    [CODE=vb]Me.Filter = "[ID] Like '" & Me![txtUserID] & "*'"[/CODE]

    Comment

    • jaishu
      New Member
      • Mar 2007
      • 22

      #3
      Thank you so much, Its pretty much the same, i was wondering if i can really use it. Anyways Thanks very much!

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by jaishu
        Thank you so much, Its pretty much the same, i was wondering if i can really use it. Anyways Thanks very much!
        You are quite welcome. The crazy thing about this business is that pretty much the same usually does not get the job done (LOL).

        Comment

        Working...