How to search a character or word by vba

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zalfa Arif
    New Member
    • Aug 2010
    • 4

    How to search a character or word by vba

    Hi All,
    Anyone can give me vba code for searching texts in ms access form or recordset. The purpose must be same as search column which is showing access form navigation bar. Becauase I need hide navigation bar and to use our own code.

    Regards,
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    A simple solution would be to but a button on the form and use the control wizard to make the button bring up the search form. In the Record Navigation category, select the Find Record Action. You can finish going through the wizard putting in your own choices. Clicking on this button will bring up the Find/Replace default window. This is the same window that would come up if you click Find in the ribbon bar in Access 2007/2010 or the Edit>Find in previous versions.

    Comment

    • Zalfa Arif
      New Member
      • Aug 2010
      • 4

      #3
      Hi Seth,
      Thanks for your reply. Let me clear what i need actual. I have a bound form with many fileds (such as first name, last name, company, job)
      I have two controls on this form. One is a unbound textfield named as txtSearch and another one is a command button named as btnSearch. When we are putting a word in the 'txtSearch' and pressing 'btnSearch', it has to search for the txtSearch value in first field of the first record. When we will make another press on btnSearch button without any changes in txtSearch field, this time it has go to next field of the same record. When all field will finish then it has to go to next record and has to repeat the same. This we can do with the search filed of navigation bar on a accfess form. The same I need in vba code without showing any dialog window such as find/replace.

      Comment

      • Seth Schrock
        Recognized Expert Specialist
        • Dec 2010
        • 2965

        #4
        How do you want to display the results? Are you looking for a complete list of records or do you just want it to stop at the first one it finds and if it isn't the one you wanted, you click search again and it finds the next?

        Comment

        • zmbd
          Recognized Expert Moderator Expert
          • Mar 2012
          • 5501

          #5
          Zalfa Arif,
          Why do you need to replicate what is already available from the software?
          What code have you tried so far? Please post it, remember to format your code using the <CODE/> format button.

          Comment

          Working...